Dm提交
authorp15692025051 <846603105@qq.com>
Thu, 18 Jan 2024 10:08:58 +0000 (18:08 +0800)
committerp15692025051 <846603105@qq.com>
Thu, 18 Jan 2024 10:08:58 +0000 (18:08 +0800)
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c
2.sdk/sdk/product/craneg_modem/hop/utilities/src/utilities.c
2.sdk/sdk/product/craneg_modem/lv_gui_main.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/core/dm_liblwm2m.h
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/core/er-coap-13/dm_er-coap-13.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/sdk/dm_lwm2msdk.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/sdk/dm_object_dm.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/shared/dm_connection.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/shared/dm_platform.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/testsdk/dm_main.c
2.sdk/sdk/product/craneg_modem/pcac/lwm2m/src/lwm2m_dm/sdksrc/testsdk/sdk_cmcc_register_info_def.h

index 595b2be..f6c7437 100644 (file)
@@ -309,13 +309,16 @@ void mmi_protocol_watch_heartbeat_action(void)
        }
 }
 
+extern void dm_send_msg_active(void);
 bool mmi_protocol_watch_link_action(void)
 {
 #ifdef __MMI_CUSTOM_HENGAI_HEALTH__
        mmi_hengai_algorithm_interface_login_action();
        mmi_hengai_health_lib_activation_check_action();
 #endif
-
+#if USE_DS_DM
+       dm_send_msg_active();
+#endif
        return mmi_protocol_fzd_action_LINK();
 }
 
index d0c00ae..5ffbab5 100644 (file)
@@ -6093,7 +6093,7 @@ void usb_uart_printf(const char* fmt, ...)
 
 int __uart_printf(const char* fmt, va_list ap)
 {
-       char buffer[128], *ptr;
+       char buffer[256], *ptr;
     if((CUSTOM_SAARN == bspGetBoardType())&&(AC_IS_SHM))
         return 0;
        memset(buffer, 0, sizeof(buffer));
index 51136cc..dacd916 100644 (file)
@@ -1288,7 +1288,7 @@ static void SensorHub_init_timer_callback(void* param)
     SensorHub_boot_bin_check_cmd();
 }
 #endif
-
+extern void dm_init();
 static void gui_main(void *param)
 {
     int silent_reset = startup_silent_reset();
@@ -1394,6 +1394,10 @@ static void gui_main(void *param)
     hal_acnt180_init();
 #elif USE_ACNT117
     hal_acnt117_init();
+#endif
+    cplog_printf("dm_init()!!!!!!!!!\n");
+#if USE_DS_DM
+    dm_init();
 #endif
     is_phase1 = 0;
     while(1) {
index db98cad..e2bc19a 100644 (file)
@@ -116,8 +116,9 @@ time_t lwm2m_gettime(void);
 #ifdef LWM2M_WITH_LOGS
 // Same usage as C89 printf()
 //void lwm2m_printf(const char * format, ...);
-#define lwm2m_printf(fmt, args...) do { CPUartLogPrintf("[lwm2m_dm]"fmt, ##args); } while(0)
-
+//#define lwm2m_printf(fmt, args...) do { cplog_printf("[lwm2m_dm]"fmt, ##args); } while(0)
+#define lwm2m_printf(FMT, ...)      printf("[lwm2m_printf]"FMT, ##__VA_ARGS__)
+// #define LOG_ARG(FMT, ...) lwm2m_printf("[%s:%d] " FMT "\r\n", __func__ , __LINE__ , __VA_ARGS__)
 #endif
 
 // communication layer
index edb2c96..fb41a15 100644 (file)
@@ -523,7 +523,8 @@ size_t coap_serialize_get_size(void *packet)
     return length;
 }
 
-/*-----------------------------------------------------------------------------------*/
+/*-------------------------------------
+注册发送封包----------------------------------------------*/
 size_t
 coap_serialize_message(void *packet, uint8_t *buffer)
 {
index 770ddbd..61140e4 100644 (file)
@@ -58,21 +58,21 @@ Options  g_opt = {  "352099001761482",                      /*CMEI_IMEI*/
                     0};                                     /*bootstrap*/
 #else
 //CMCC DMP V4.0
-Options  g_opt = {  "深圳市大山智慧科技有限公司",                                  /*brand*/
-                    "Z12",                                 /*model*/
+Options  g_opt = {  "DS",                                  /*brand*/
+                    "D9-D10-D11-D12",                                 /*model*/
                     "M100001028",                           /*appKey*/
                     "397fub217U67fmqz39a2938WG90d1857",     /*pwd*/
                     "4.0.1",                                /*sdkVersion*/
                     "4.0.1",                                /*apiVersion*/
-                    "SZDS2022",                             /*templatID*/
+                    "TY000014",                             /*templatID*/
                     "3520990017614823",                     /* imei1 */
                     "",                                     /* imei2 */
                     "460075551608160",                      /* imei2 */
-                    4,                                      /*ip type,4/6*/
-#if 0
+                    6,                                      /*ip type,4/6*/
+#if 1
                     "m.fxltsbl.com",                        /*server address*/
 #else
-                    "coap://b.fxltsbl.com",                   /*test server address*/
+                    "shipei.fxltsbl.com",                   /*test server address*/
 #endif
                     5683,                                   /*server port*/
                     86400,                                    /*life time*/
@@ -793,6 +793,7 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
 }
 #else
 //CMCC DMP V4.0
+#include "IMEI.h"
 int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
 {
     client_data_t data;
@@ -834,6 +835,11 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
     }
 
 
+       //app_adp_get_imei_req(g_opt.szCMEI_IMEI);
+    IMEIStr imeiStr;
+    IMEIReadStr(&imeiStr);
+    memcpy(g_opt.szCMEI_IMEI,imeiStr.imei_digits,16);
+    LOG_M("LWM2M_SDK_RUN_PARAMg_opt.szCMEI_IMEI:%s!\n",g_opt.szCMEI_IMEI);
     char *szStars="****";
     char epnametmp[256];
     memset(epnametmp,0,sizeof(epnametmp));
@@ -945,7 +951,7 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
 
 
     //signal(SIGINT, handle_sigint);
-    LOG_M("LWM2M Client \"%s\" started on port %s.\r\nUse Ctrl-C to exit.\r\n\n", name, localPort);
+    LOG_M("LWM2M Client2 \"%s\" started on port %s.\r\nUse Ctrl-C to exit.\r\n\n", name, localPort);
     g_quit = 0;
 
     /*
@@ -1014,7 +1020,17 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
                 } else {
                     numBytes = recvfrom(data.sock, buffer, MAX_PACKET_SIZE, 0, (struct sockaddr *)&addr6, &addrLen);
                 }
-
+                cplog_printf("lwm2m_printf:recvfrom:\n");
+                int x;
+                for( x=0;x<numBytes;x++)
+                {
+                    cplog_printf("%02X ",buffer[x]);
+                    if((x)%20 == 0&&x!=0)
+                    {
+                        cplog_printf("\n");
+                    }
+                }
+                cplog_printf("\n");
                 if (0 > numBytes) {
                     LOG_M("Error in recvfrom(): %d %s\r\n", errno, strerror(errno));
                 } else if (0 < numBytes) {
@@ -1023,6 +1039,7 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
                     if(g_opt.nAddressFamily==4) {
                         connP = connection_find(data.connList, &addr, addrLen);
                     } else {
+                        LOG_M("LWM2M_SDK_RUN_PARAM:addr6 %x %x %x\r\n", addr6.sin6_addr.un.u32_addr[0],addr6.sin6_addr.un.u32_addr[1],addr6.sin6_addr.un.u32_addr[2]);
                         connP = connection_find6(data.connList, &addr6, addrLen);
                     }
 
@@ -1031,6 +1048,7 @@ int LWM2M_SDK_RUN_PARAM(int argc, char *argv[])
                          * Let liblwm2m respond to the query depending on the context
                          */
                         lwm2m_handle_packet(lwm2mH, buffer, numBytes, connP);
+                        LOG_M("buffer2222:%s\r\n", buffer);
                     } else {
                         /*
                          * This packet comes from an unknown peer
index 71f1da8..933fc96 100644 (file)
@@ -102,8 +102,8 @@ static uint8_t prv_dm_read(uint16_t instanceId,
     int iret = 0;
     do
     {
-
-        if((*dataArrayP)[i].id >=RES_DM_DEV_INFO && (*dataArrayP)[i].id <= RES_DM_NETWORK_STATUS )
+        LOG_ARG("resId=%u,lwm2m_sdk_dm_get_devinfo,iret=%d",(*dataArrayP)[i].id ,iret);
+        if((*dataArrayP)[i].id >=RES_DM_DEV_INFO && (*dataArrayP)[i].id <= RES_DM_RESOLUTION )
         {
             //char sztmp[512];
             char *outbuff = NULL;
index d0cc696..3aa3182 100644 (file)
@@ -258,11 +258,24 @@ int connection_send(connection_t *connP,
 
     output_buffer(stderr, buffer, length, 0);
 #endif
-
+    cplog_printf("lwm2m_printf:connection_send:%s\n",buffer);
     offset = 0;
     while (offset != length)
     {
         nbSent = sendto(connP->sock, buffer + offset, length - offset, 0, (struct sockaddr *)&(connP->addr), connP->addrLen);
+        
+        cplog_printf("lwm2m_printf:sendto:\n");
+        int x;
+        char *data = buffer + offset;
+        for( x=0;x<(length - offset);x++)
+        {
+            cplog_printf("%02X ",data[x]);
+            if((x)%30 == 0&&x!=0)
+            {
+                cplog_printf("\n");
+            }
+        }
+        cplog_printf("\n");
         if (nbSent == -1) return -1;
         offset += nbSent;
     }
index b302a88..5891a15 100644 (file)
@@ -76,7 +76,7 @@ time_t lwm2m_gettime(void)
     //current_tick =current_tick-8*60*60;
     
     current_tick = time(NULL);
-    lwm2m_printf("%s,current_tick %u",__func__,current_tick);
+    lwm2m_printf("%s,current_tick %u\n",__func__,current_tick);
     //temp_tick = current_tick;
     //temp_tick = temp_tick*1000;
     //lwm2m_printf("%s,return current_tick %llu,len=%d",__func__,temp_tick,sizeof(uint64_t));
index 83a7be6..d5415c1 100644 (file)
@@ -10,7 +10,7 @@
 //#include "cJSON.h"
 #include "../../../../../alios/common/include/cJSON.h"
 #include "sdk_cmcc_register_info_def.h"
-
+char yipeidai[]={0xe6,0x9c,0xaa,0xe4,0xbd,0xa9,0xe6,0x88,0xb4,0x00};
 struct dmMsg
 {
        UINT32 msgID;
@@ -219,7 +219,7 @@ int myDMReadInfo(int resId,char **outbuff)
         case 6619://wear state
             // is_wearingstatus = 0;
             // snprintf(buff,buflen,"%s",is_wearingstatus==0?"unwear":"wear");
-            snprintf(buff,buflen,"%s","δÅå´÷");
+            snprintf(buff,buflen,"%s","0");
             break;
         case 6620://board version
             snprintf(buff,buflen,REG_BOARD);
index 69593e5..aff2d2c 100644 (file)
@@ -24,7 +24,7 @@
 #define REG_SCREENSIZE                     "1.69"
 #define REG_BATTERY                        "***"
 #define REG_ROUTER_MAC                     "***"
-#define REG_NETWORK_STATUS                 "LTE"
+#define REG_NETWORK_STATUS                 "***"
 
 #endif