修改代码
This commit is contained in:
parent
655030455f
commit
2eb6971660
|
@ -708,7 +708,7 @@ static north_protocol_u parse_json_north(const char protoContent[MAX_CONFIG_CONT
|
|||
* @param[in] devId 设备ID
|
||||
* @return 返回匹配设备的点位数组,未找到返回 NULL
|
||||
*********************************************************************/
|
||||
point_t *get_pointArr(dev_type_e devType, uint16_t devId)
|
||||
point_t *get_pointArr(dev_type_e devType, uint16_t devArrayId)
|
||||
{
|
||||
for (int i = 0; i < kProto_Master_End; i++)
|
||||
{
|
||||
|
@ -718,7 +718,7 @@ point_t *get_pointArr(dev_type_e devType, uint16_t devId)
|
|||
}
|
||||
for (int j = 0; j < protoTable[i].devNum; j++)
|
||||
{
|
||||
if (protoTable[i].devPointMapArr[j].devType == devType && protoTable[i].devPointMapArr[j].devId == devId)
|
||||
if (protoTable[i].devPointMapArr[j].devType == devType && (protoTable[i].devPointMapArr[j].devId == devArrayId + 1))
|
||||
{
|
||||
return protoTable[i].devPointMapArr[j].pointArr; // 返回匹配设备的 pointArr
|
||||
}
|
||||
|
@ -726,3 +726,28 @@ point_t *get_pointArr(dev_type_e devType, uint16_t devId)
|
|||
}
|
||||
return NULL; // 未找到匹配设备,返回 NULL
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @brief 根据设备类型和设备ID获取设备的点位数组
|
||||
* @param[in] devType 设备类型
|
||||
* @param[in] devId 设备ID
|
||||
* @return 返回匹配设备的点位数组,未找到返回 NULL
|
||||
*********************************************************************/
|
||||
dev_info_t *get_devPointMapArr(dev_type_e devType, uint16_t devArrayId)
|
||||
{
|
||||
for (int i = 0; i < kProto_Master_End; i++)
|
||||
{
|
||||
if (protoTable[i].devPointMapArr == NULL)
|
||||
{
|
||||
continue; // 跳过空协议
|
||||
}
|
||||
for (int j = 0; j < protoTable[i].devNum; j++)
|
||||
{
|
||||
if (protoTable[i].devPointMapArr[j].devType == devType && (protoTable[i].devPointMapArr[j].devId == devArrayId + 1))
|
||||
{
|
||||
return &protoTable[i].devPointMapArr[j]; // 返回匹配设备的 pointArr
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL; // 未找到匹配设备,返回 NULL
|
||||
}
|
||||
|
|
|
@ -41,6 +41,14 @@ extern advanced_setting_t AdvancedSettingTable[kAdvanced_Setting_Type_End];
|
|||
*********************************************************************/
|
||||
point_t *get_pointArr(dev_type_e devType, uint16_t devId);
|
||||
|
||||
/*********************************************************************
|
||||
* @brief 根据设备类型和设备ID获取设备的点位数组
|
||||
* @param[in] devType 设备类型
|
||||
* @param[in] devId 设备ID
|
||||
* @return 返回匹配设备的点位数组,未找到返回 NULL
|
||||
*********************************************************************/
|
||||
dev_info_t *get_devPointMapArr(dev_type_e devType, uint16_t devArrayId);
|
||||
|
||||
/*********************************************************************
|
||||
* @brief 读取系统配置的设备数量
|
||||
* @param[in] item: 接入EMS的所有设备类型数量
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,9 @@
|
|||
network:
|
||||
ethernets:
|
||||
eth0:
|
||||
addresses: [192.169.0.123/24]
|
||||
nameservers:
|
||||
addresses: [114.114.114.114,8.8.8.8]
|
||||
eth1:
|
||||
dhcp4: true
|
||||
version: 2
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue