1、增加ExclCommUint_t结构体,用于排除指定通讯单元的MAC
2、修复了复位后重复定义各项参数的bug。只有从flash读取到的出厂标志位错误时,才会进入配置默认参数判断,否则会以从flash读取到的数据为配置参数 3、增加CheckCommUnitExcl函数,用于查询mac是否被排除 GateWay_Debug: 1、rs485配置函数增加了boot升级使能功能 2、增加了excu、exdel、exls命令,用于配置排除设备的增、删、查 3、para命令增加显示LpCfg参数 sx127x: 1、lora通道选择取消,通过修改频率来修改通道
This commit is contained in:
@@ -184,7 +184,7 @@ int NetCommOrgData(GateWayPara GateWay, uint8_t *MegData, uint8_t *OutData)
|
||||
* 功能描述: 检查设备是否注册
|
||||
* 参 数: GateWay,网关句柄
|
||||
CommUnitMac, 待检查的设备MAC
|
||||
* 返 回 值: 已注册返回true,没注册返回false
|
||||
* 返 回 值: 已注册返回非0,没注册返回-1
|
||||
*****************************************************************************************/
|
||||
int CheckCommUnitReg(GateWayPara GateWay, uint8_t *CommUnitMac)
|
||||
{
|
||||
@@ -196,8 +196,23 @@ int CheckCommUnitReg(GateWayPara GateWay, uint8_t *CommUnitMac)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************************
|
||||
* 函数名称: CheckCommUnitExcl
|
||||
* 功能描述: 检查设备是否排除
|
||||
* 参 数: GateWay,网关句柄
|
||||
CommUnitMac, 待检查的设备MAC
|
||||
* 返 回 值: 已排除返回非0,没排除返回-1
|
||||
*****************************************************************************************/
|
||||
int CheckCommUnitExcl(GateWayPara GateWay, uint8_t *CommUnitMac)
|
||||
{
|
||||
for(int i = 0; i < COMMUNIT_NUM_MAX; i++) {//判断是否被排除
|
||||
if(memcmp(GateWay->ConfigPara.ExclCommUnit[i].ExclMac, CommUnitMac, 6) == 0) {
|
||||
if(GateWay->ConfigPara.ExclCommUnit[i].ExclFlag == true)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/*****************************************************************************************
|
||||
* 函数名称: CommUnitSendCmd
|
||||
* 功能描述: 网关下发通讯单元指令函数
|
||||
@@ -445,7 +460,7 @@ void DebugDisplaySensorData(int SensorIdx, uint16_t SensorType, uint8_t *SensorD
|
||||
int CommUnitAnalyze(GateWayPara GateWay, uint8_t *rData, uint16_t rLen, SendData Response)
|
||||
{
|
||||
uint16_t check, crc16;
|
||||
int CommUnitIdx;
|
||||
int CommUnitIdx, ExclCommUnit;
|
||||
uint16_t PayLoadLen;
|
||||
uint8_t *PayLoad;
|
||||
uint8_t *MegData;
|
||||
@@ -468,12 +483,17 @@ int CommUnitAnalyze(GateWayPara GateWay, uint8_t *rData, uint16_t rLen, SendData
|
||||
if((CUHeader->Cmd != COMM_UNIT_CMD_REG) && (memcmp(GateWay->ConfigPara.GwMac, CUHeader->GWMac, 6) != 0))
|
||||
return -1;
|
||||
|
||||
CommUnitIdx = CheckCommUnitReg(GateWay, CUHeader->DevMac);
|
||||
CommUnitIdx = CheckCommUnitReg(GateWay, CUHeader->DevMac);//判断是否是已注册的设备
|
||||
if(CommUnitIdx < 0) {
|
||||
if(CUHeader->Cmd != COMM_UNIT_CMD_REG)
|
||||
if(CUHeader->Cmd != COMM_UNIT_CMD_REG){//判断是否是注册请求
|
||||
return -1;
|
||||
}
|
||||
ExclCommUnit = CheckCommUnitExcl(GateWay, CUHeader->DevMac);//判断是否是被排除的设备
|
||||
if(ExclCommUnit > -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(CUHeader->Cmd) {
|
||||
case COMM_UNIT_CMD_REG:{
|
||||
if(PayLoad[0] > SENSOR_NUM_MAX) {
|
||||
|
||||
Reference in New Issue
Block a user