@@ -145,17 +145,22 @@ static int http_report_func(void *handle, const char *topic_name, int req_ack, v
145
145
{
146
146
iotx_http_message_param_t msg_param ;
147
147
char request_buf [1024 ];
148
+ char topic_path [100 ];
149
+
148
150
if (handle == NULL || topic_name == NULL || data == NULL ) {
149
151
http_err ("params err" );
150
152
return -1 ;
151
153
}
154
+
155
+ HAL_Snprintf (topic_path , sizeof (topic_path ), "/topic%s" , topic_name );
156
+
152
157
memset (& msg_param , 0 , sizeof (iotx_http_message_param_t ));
153
158
msg_param .request_payload = (char * )data ;
154
159
msg_param .response_payload = request_buf ;
155
160
msg_param .timeout_ms = CONFIG_MID_HTTP_TIMEOUT ;
156
161
msg_param .request_payload_len = len ;
157
162
msg_param .response_payload_len = 1024 ;
158
- msg_param .topic_path = ( char * ) topic_name ;
163
+ msg_param .topic_path = topic_path ;
159
164
160
165
return IOT_HTTP_SendMessage (handle , & msg_param );
161
166
}
@@ -193,6 +198,10 @@ void *IOT_HTTP_Init(iotx_http_param_t *pInitParams)
193
198
194
199
p_devinfo = pInitParams -> device_info ;
195
200
201
+ HAL_SetProductKey (p_devinfo -> product_key );
202
+ HAL_SetDeviceName (p_devinfo -> device_name );
203
+ HAL_SetDeviceSecret (p_devinfo -> device_secret );
204
+
196
205
iotx_http_context = (iotx_http_t * )HTTP_API_MALLOC (sizeof (iotx_http_t ));
197
206
198
207
if (NULL == iotx_http_context ) {
@@ -481,12 +490,22 @@ int IOT_HTTP_DeviceNameAuth(void *handle)
481
490
iotx_set_report_func (http_report_func );
482
491
/* report module id */
483
492
ret = iotx_report_mid (iotx_http_context );
484
- // /* report module id */
485
- // ret = iotx_http_report_mid(iotx_http_context);
486
493
if (SUCCESS_RETURN != ret ) {
487
494
http_err ("Send ModuleId message to server(Http) failed, ret = %d" , ret );
488
495
goto do_exit ;
489
496
}
497
+ /* report device information */
498
+ ret = iotx_report_devinfo (iotx_http_context );
499
+ if (SUCCESS_RETURN != ret ) {
500
+ http_err ("Send devinfo message to server(Http) failed, ret = %d" , ret );
501
+ goto do_exit ;
502
+ }
503
+ /* report firmware */
504
+ ret = iotx_report_firmware_version (iotx_http_context );
505
+ if (SUCCESS_RETURN != ret ) {
506
+ http_err ("Send firmware message to server(Http) failed, ret = %d" , ret );
507
+ goto do_exit ;
508
+ }
490
509
491
510
ret = 0 ;
492
511
0 commit comments