如下图
源码分析
上面已经把服务器和网关搭建好了,接下来我们使用官方的SDK修改一份代码,代码内容包括节点密钥的填写,入网方式的更改
源码路径
入网配网参数修改
这里我们使用的ABP入网参数,参数需要与服务器节点设备设置的参数一致
#define LORAWAN\_APP\_PORT 2
static uint8\_t DevEui[] = LORAWAN_DEVICE_EUI;
static uint8\_t AppEui[] = LORAWAN_APPLICATION_EUI;
static uint8\_t AppKey[] = LORAWAN_APPLICATION_KEY;
#if( OVER\_THE\_AIR\_ACTIVATION == 0 )
static uint8\_t NwkSKey[] = LORAWAN_NWKSKEY;
static uint8\_t AppSKey[] = LORAWAN_APPSKEY;
static uint32\_t DevAddr = LORAWAN_DEVICE_ADDRESS;
上行数据
/\*!
\* \brief Prepares the payload of the frame
\*/
static void PrepareTxFrame( uint8\_t port )
{
AppDataSize = 4;
AppData[0] = 0x00;
AppData[1] = 0x01;
AppData[2] = 0x02;
AppData[3] = 0x03;
}
下行数据
/\*!
\* \brief MCPS-Indication event function
\*
\* \param [IN] mcpsIndication - Pointer to the indication structure,
\* containing indication attribut