大家好、
我的 dlms cosem 库版本5.4有问题。
我有一个活动日历对象需要填充一个设置请求、但由于我需要写入的数据大于厚块大小、因此请求被分成更小的请求(用块设置)。
对象定义为:
{Assoc_MR_US、 Class_ID_ACTIVE_Calendar、 0、{0、0、13、0、 0、255}、10、Obj_Active_Calendar、1、 obj_Active_Calendar_Methods}、
其中 Obj_Active_Calendar 定义为:
静态常量结构 attribute_desc_s Obj_Active_Calendar[]={ {1、ACCESS_PC___MRR__USR_、TAG_OBIT_STRING、(void *) object_list[19].instance_id、NULL}、 {2、ACCESS_PC___MRR__USR_、TAG_OBIT_STRING、(void *) Calendar_Name_Active、NULL}、 {3、ACCESS_PC__MRR_USR_、TAG_ARRAY、 (void *) Data_Buffer、Access_Season_Profile}、 {4、ACCESS_PC__MRR_USR_、TAG_ARRAY、 (void *) Data_Buffer、Access_Week_Profile_Table}、 {5、ACCESS_PC__MRR_USR_、TAG_ARRAY、 (void *) Data_Buffer、Active_Access_Day Profile_Table}、 {6、ACCESS_PC___MRR__USRW、TAG_Boct_string、(void *) Calendar_Name_Passive、NULL}、 {7、ACCESS_PC__MRR_USR_、TAG_ARRAY、 (void *) Data_Buffer、Access_Season_Profile}、 {8、ACCESS_PC__MRR_USR_、TAG_ARRAY、 (void *) Data_Buffer、Access_Week_Profile_Table}、 {9、ACCESS_PC__MRR__USRW、TAG_ARRAY、 (void *) Data_Buffer、Passive_Access_Day Profile_Table}、 {10、access_PC____MRR__USRW、tag_octet_string、(void *) Activate_Passive_Calendar_Time、NULL} ;
和 Passive_Access_Day Profile_Table 定义为:
void Passive_Access_Day Profile_Table (void *dataptr、int direction){ if (direction =attr_read){ MSG_INFO_TEMPLATE =天_配置文件_模板; MSG_INFO_SZ_TEMPLATE = sizeof (day _配置文件_模板); MSG_INFO_num_entries = 84; MSG_INFO_START_ENCED=0; } 否则、如果(DIRECTION = ATTR_WRITE){ MSG_INFO_TEMPLATE =天_配置文件_模板; MSG_INFO_SZ_TEMPLATE = sizeof (day _配置文件_模板); MSG_INFO_num_entries = 84;
MSG_INFO_START_ENCED=0;
}
}
模板定义为:
const uint8_t Day Profile_Template[]={ tag_structure、2、\ 填充数据| TAG_UINT8、ITEM_TAG_DAY ID、 Tag_array、24、 Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_dY_profile_script_ID)、/*脚本 id*/ Tag_structure、3、 填充数据| tag_octet_string、4、item_tag_day _profile_start_time、0、0、0、0、/*开始时间*/ Tag_octet_string、6、0、0、10、 0、100、255、/*obis 脚本表的代码*/ 填充数据| tag_UINT16、INJECT16 (item_tag_date_profile_script_ID)、/*脚本 id*/ };
基本上、我有这种数据结构:
[84] x{
uint8、item_tag_day、
[24] x{
八位位组_string、item_tag_day、profile_start_time、
八位位组_string、6、0、0、0、0、0、0
uint16、item_tag_day 配置文件脚本 ID)
}
}
现在、如果我尝试写入包含84个元素的整个数组、则 使用'DIVE_ACCESS_DAY _Profile_Table 函数被正确调用并使用'DIVY = ATTR_WRITE'参数、但是 SET_STRING_Item 和 SET_numeral_Item 永远不会使用指定的项目标签进行调用。
在"mSG_info.template=Day Profile_Template"行使用断点会显示"Data_Buffer"(用于存储接收到的 PDU 的变量)为空。
例如、如果我写入1个元素而不是所有84个元素(因此使用包含所有数据的单个设置请求)、则'data_Buffer'变量将填充从客户端发送的 PDU。
TLDR:看起来"带块设置"函数(根据 slaa614、库支持该函数)不会使用正确的参数调用 SET_STRING_ITEM 和 SET_NUMER_ITEM。 同时、简单设置请求工作正常。
从仪表读取数据不会出现单个元件和84个元件的问题。
使用块请求发送集的客户端示例(Data_Buffer 为空):
C1 02 81 00 14 00 0D 00 00 FF 09 00 00 00 00 00 01 82 03 be 01 18 02 11 01 01 18 02 03 09 04 00 00 00 00 09 06 00 00 00 00 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 069 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 00 00 00 00 00 00 64 FF 12 00 08 02 03 04 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 09 06 00 00 00 00 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 00 00 00 64 FF 12 00 08 02 03 09 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 02 11 02 01 18 02 03 09 04 00 00 00 00 00 00 09 00 09 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 04 00 00 00 00 09 06 00 00 00 00 00 64 FF 12 00 08 02 03 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 069 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 00 00 00 00 00 00 64 FF 12 00 08 02 03 04 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 09 06 00 00 00 00 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 00 00 00 64 FF 12 00 08 02 02 11 03 01 18 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 05 02 03 09 04 00 00 00
发送设置请求的客户端示例(84 - Data_Buffer 中只有一个元素正确填充 PDU):
C1 01 81 00 14 00 0D 00 00 FF 09 00 01 01 01 02 02 11 01 18 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 09 06 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 00 00 00 64 FF 12 00 08 02 03 09 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 00 00 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 00 00 00 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 00 00 0A 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 00 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 00 00 09 00 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 09 06 00 0A 00 64 FF 12 00 08 02 03 04 00 00 00 09 06 00 00 00 00 00 00 00 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 00 09 06 00 00 0A 00 64 FF 12 00 08 02 03 09 04 00 00 00 00 09 06 00 0A 00 64 FF 12 00 08
我是否缺少一些信息以使组合工作正常?
感谢您的帮助!
Alan