Link Kit C-SDK  5.0.0
aiot_state_api.h
浏览该文件的文档.
1 
10 #ifndef _AIOT_STATE_API_H_
11 #define _AIOT_STATE_API_H_
12 
13 #if defined(__cplusplus)
14 extern "C" {
15 #endif
16 
17 #include <stdint.h>
18 
22 typedef int32_t (* aiot_state_logcb_t)(int32_t code, char *message);
23 
32 
33 typedef enum {
34  LOG_LEVEL_NONE = 0, /* 不输出日志 */
38 } log_level_t;
39 
47 int32_t aiot_state_set_log_level(log_level_t level);
48 
53 #define STATE_SUCCESS (0x0000)
54 
59 #define STATE_USER_INPUT_BASE (-0x0100)
60 
65 #define STATE_USER_INPUT_NULL_POINTER (-0x0101)
66 
71 #define STATE_USER_INPUT_OUT_RANGE (-0x0102)
72 
77 #define STATE_USER_INPUT_UNKNOWN_OPTION (-0x0103)
78 
83 #define STATE_USER_INPUT_MISSING_PRODUCT_KEY (-0x0104)
84 
89 #define STATE_USER_INPUT_MISSING_DEVICE_NAME (-0x0105)
90 
95 #define STATE_USER_INPUT_MISSING_DEVICE_SECRET (-0x0106)
96 
101 #define STATE_USER_INPUT_MISSING_PRODUCT_SECRET (-0x0107)
102 
107 #define STATE_USER_INPUT_MISSING_HOST (-0x0108)
108 
113 #define STATE_USER_INPUT_EXEC_DISABLED (-0x0109)
114 
119 #define STATE_USER_INPUT_JSON_PARSE_FAILED (-0x010A)
120 
125 #define STATE_SYS_DEPEND_BASE (-0x0200)
126 
131 #define STATE_SYS_DEPEND_MALLOC_FAILED (-0x0201)
132 
137 #define STATE_SYS_DEPEND_NWK_INVALID_OPTION (-0x0202)
138 
143 #define STATE_SYS_DEPEND_NWK_EST_FAILED (-0x0203)
144 
149 #define STATE_SYS_DEPEND_NWK_CLOSED (-0x0204)
150 
155 #define STATE_SYS_DEPEND_NWK_READ_LESSDATA (-0x0205)
156 
161 #define STATE_SYS_DEPEND_NWK_WRITE_LESSDATA (-0x0206)
162 
167 #define STATE_SYS_DEPEND_NWK_READ_OVERTIME (-0x0207)
168 
173 #define STATE_SYS_DEPEND_NWK_INVALID_CRED (-0x0208)
174 
179 #define STATE_SYS_DEPEND_NWK_SEND_ERR (-0x0209)
180 
185 #define STATE_SYS_DEPEND_NWK_RECV_ERR (-0x020A)
186 
191 #define STATE_MQTT_BASE (-0x0300)
192 
197 #define STATE_MQTT_CONNACK_FMT_ERROR (-0x0301)
198 
203 #define STATE_MQTT_CONNACK_RCODE_UNACCEPTABLE_PROTOCOL_VERSION (-0x0302)
204 
209 #define STATE_MQTT_CONNACK_RCODE_SERVER_UNAVAILABLE (-0x0303)
210 
215 #define STATE_MQTT_CONNACK_RCODE_BAD_USERNAME_PASSWORD (-0x0304)
216 
221 #define STATE_MQTT_CONNACK_RCODE_NOT_AUTHORIZED (-0x0305)
222 
227 #define STATE_MQTT_CONNACK_RCODE_UNKNOWN (-0x0306)
228 
233 #define STATE_MQTT_PUBLIST_PACKET_ID_ROLL (-0x0307)
234 
239 #define STATE_MQTT_TOPIC_INVALID (-0x0308)
240 
245 #define STATE_MQTT_LOG_TOPIC (-0x0309)
246 
251 #define STATE_MQTT_LOG_HEXDUMP (-0x030A)
252 
257 #define STATE_MQTT_CONNECT_SUCCESS (-0x030B)
258 
263 #define STATE_MQTT_MALFORMED_REMAINING_LEN (-0x030C)
264 
269 #define STATE_MQTT_MALFORMED_REMAINING_BYTES (-0x030D)
270 
275 #define STATE_MQTT_PACKET_TYPE_UNKNOWN (-0x030E)
276 
281 #define STATE_MQTT_SUBACK_RCODE_FAILURE (-0x030F)
282 
287 #define STATE_MQTT_SUBACK_RCODE_UNKNOWN (-0x0310)
288 
293 #define STATE_MQTT_TOPIC_COMPARE_FAILED (-0x0311)
294 
299 #define STATE_MQTT_DEINIT_TIMEOUT (-0x0312)
300 
305 #define STATE_MQTT_LOG_CONNECT (-0x0313)
306 
311 #define STATE_MQTT_LOG_RECONNECTING (-0x0314)
312 
317 #define STATE_MQTT_LOG_CONNECT_TIMEOUT (-0x0315)
318 
323 #define STATE_MQTT_LOG_DISCONNECT (-0x0316)
324 
329 #define STATE_MQTT_LOG_USERNAME (-0x0317)
330 
335 #define STATE_MQTT_LOG_PASSWORD (-0x0318)
336 
341 #define STATE_MQTT_LOG_CLIENTID (-0x0319)
342 
347 #define STATE_MQTT_LOG_TLS_PSK (-0x031A)
348 
353 #define STATE_MQTT_TOPIC_TOO_LONG (-0x031B)
354 
359 #define STATE_MQTT_PUB_PAYLOAD_TOO_LONG (-0x031C)
360 
365 #define STATE_MQTT_LOG_BACKUP_IP (-0x031D)
366 
371 #define STATE_MQTT_RECV_INVALID_PINRESP_PACKET (-0x031E)
372 
377 #define STATE_MQTT_RECV_INVALID_PUBLISH_PACKET (-0x031F)
378 
383 #define STATE_MQTT_RECV_INVALID_PUBACK_PACKET (-0x0320)
384 
389 #define STATE_MQTT_UNKNOWN_PROPERTY_OPTION (-0x0321)
390 
395 #define STATE_MQTT_INVALID_PROTOCOL_VERSION (-0x0322)
396 
401 #define STATE_MQTT_RECV_INVALID_SERVER_DISCONNECT_PACKET (-0x0323)
402 
407 #define STATE_MQTT_INVALID_USER_PERPERTY_DATA (-0x0324)
408 
413 #define STATE_MQTT_INVALID_USER_PERPERTY_LEN (-0x0325)
414 
419 #define STATE_MQTT_INVALID_TX_PACK_SIZE (-0x0326)
420 
425 #define STATE_MQTT_RECEIVE_MAX_EXCEEDED (-0x0327)
426 
431 #define STATE_MQTT_INVALID_SUBSCRIPTION_IDENTIFIER (-0x0328)
432 
437 #define STATE_MQTT_INVALID_PROPERTY_LEN (-0x0329)
438 
443 #define STATE_MQTT_LOG_HOST (-0x032A)
444 
449 #define STATE_HTTP_BASE (-0x0400)
450 
455 #define STATE_HTTP_STATUS_LINE_INVALID (-0x0401)
456 
461 #define STATE_HTTP_READ_BODY_FINISHED (-0x0402)
462 
467 #define STATE_HTTP_DEINIT_TIMEOUT (-0x0403)
468 
473 #define STATE_HTTP_AUTH_CODE_FAILED (-0x0404)
474 
479 #define STATE_HTTP_AUTH_NOT_FINISHED (-0x0405)
480 
485 #define STATE_HTTP_AUTH_TOKEN_FAILED (-0x0406)
486 
491 #define STATE_HTTP_NEED_AUTH (-0x0407)
492 
497 #define STATE_HTTP_RECV_NOT_FINISHED (-0x0408)
498 
503 #define STATE_HTTP_HEADER_BUFFER_TOO_SHORT (-0x0409)
504 
509 #define STATE_HTTP_HEADER_INVALID (-0x040A)
510 
515 #define STATE_HTTP_LOG_SEND_HEADER (-0x040B)
516 
521 #define STATE_HTTP_LOG_SEND_CONTENT (-0x040C)
522 
527 #define STATE_HTTP_LOG_RECV_HEADER (-0x040D)
528 
533 #define STATE_HTTP_LOG_RECV_CONTENT (-0x040E)
534 
539 #define STATE_HTTP_LOG_DISCONNECT (-0x040F)
540 
545 #define STATE_HTTP_LOG_AUTH (-0x0410)
546 
551 #define STATE_HTTP_AUTH_NOT_EXPECTED (-0x0411)
552 
557 #define STATE_HTTP_READ_BODY_EMPTY (-0x0412)
558 
563 #define STATE_PORT_BASE (-0x0F00)
564 
569 #define STATE_PORT_INPUT_NULL_POINTER (-0x0F01)
570 
575 #define STATE_PORT_INPUT_OUT_RANGE (-0x0F02)
576 
581 #define STATE_PORT_MALLOC_FAILED (-0x0F03)
582 
587 #define STATE_PORT_MISSING_HOST (-0x0F04)
588 
593 #define STATE_PORT_TCP_CLIENT_NOT_IMPLEMENT (-0x0F05)
594 
599 #define STATE_PORT_TCP_SERVER_NOT_IMPLEMENT (-0x0F06)
600 
605 #define STATE_PORT_UDP_CLIENT_NOT_IMPLEMENT (-0x0F07)
606 
611 #define STATE_PORT_UDP_SERVER_NOT_IMPLEMENT (-0x0F08)
612 
617 #define STATE_PORT_NETWORK_UNKNOWN_OPTION (-0x0F09)
618 
623 #define STATE_PORT_NETWORK_UNKNOWN_SOCKET_TYPE (-0x0F0A)
624 
629 #define STATE_PORT_NETWORK_DNS_FAILED (-0x0F0B)
630 
635 #define STATE_PORT_NETWORK_SOCKET_CREATE_FAILED (-0x0F0C)
636 
641 #define STATE_PORT_NETWORK_SOCKET_CONFIG_FAILED (-0x0F0D)
642 
647 #define STATE_PORT_NETWORK_SOCKET_BIND_FAILED (-0x0F0E)
648 
653 #define STATE_PORT_NETWORK_CONNECT_TIMEOUT (-0x0F0F)
654 
659 #define STATE_PORT_NETWORK_CONNECT_FAILED (-0x0F10)
660 
665 #define STATE_PORT_NETWORK_SELECT_FAILED (-0x0F11)
666 
671 #define STATE_PORT_NETWORK_SEND_FAILED (-0x0F12)
672 
677 #define STATE_PORT_NETWORK_RECV_FAILED (-0x0F13)
678 
683 #define STATE_PORT_NETWORK_SEND_CONNECTION_CLOSED (-0x0F14)
684 
689 #define STATE_PORT_NETWORK_RECV_CONNECTION_CLOSED (-0x0F15)
690 
695 #define STATE_PORT_TLS_INVALID_CRED_OPTION (-0x0F16)
696 
701 #define STATE_PORT_TLS_INVALID_MAX_FRAGMENT (-0x0F17)
702 
707 #define STATE_PORT_TLS_INVALID_SERVER_CERT (-0x0F18)
708 
713 #define STATE_PORT_TLS_INVALID_CLIENT_CERT (-0x0F19)
714 
719 #define STATE_PORT_TLS_INVALID_CLIENT_KEY (-0x0F1A)
720 
725 #define STATE_PORT_TLS_SOCKET_CREATE_FAILED (-0x0F1B)
726 
731 #define STATE_PORT_TLS_SOCKET_CONNECT_FAILED (-0x0F1C)
732 
737 #define STATE_PORT_TLS_INVALID_RECORD (-0x0F1D)
738 
743 #define STATE_PORT_TLS_RECV_FAILED (-0x0F1E)
744 
749 #define STATE_PORT_TLS_SEND_FAILED (-0x0F1F)
750 
755 #define STATE_PORT_TLS_RECV_CONNECTION_CLOSED (-0x0F20)
756 
761 #define STATE_PORT_TLS_SEND_CONNECTION_CLOSED (-0x0F21)
762 
767 #define STATE_PORT_TLS_CONFIG_PSK_FAILED (-0x0F22)
768 
773 #define STATE_PORT_TLS_INVALID_HANDSHAKE (-0x0F23)
774 
779 #define STATE_PORT_DTLS_CONFIG_PSK_FAILED (-0x0F24)
780 
785 #define STATE_PORT_DTLS_HANDSHAKE_FAILED (-0x0F25)
786 
791 #define STATE_PORT_NETWORK_DTLS_CONNECT_FAILED (-0x0F26)
792 
797 #define STATE_PORT_DTLS_HANDSHAKE_IN_PROGRESS (-0x0F27)
798 
803 #define STATE_PORT_PTHREAD_CREATE_FAILED (-0x0F28)
804 
809 #define STATE_ADAPTER_ERROR (-0x1000)
810 
815 #define STATE_NONSUPPORT (-0x1100)
816 
821 #define STATE_DEVICE_REPEATED_CONNECT (-0x1101)
822 
827 #define STATE_DEVICE_MISSING_CONNECT_ARGS (-0x1102)
828 
833 #define STATE_DEVICE_OFFLINE (-0x1103)
834 
839 #define STATE_DEVICE_REPEATED_DISCONNECT (-0x1104)
840 
845 #define STATE_DEVICE_UNKOWN_ERROR (-0x1105)
846 
851 #define STATE_DEVICE_DYNREG_TIMEOUT (-0x1106)
852 
857 #define STATE_MESSAGE_CREATE_ERROR (-0x1201)
858 
863 #define STATE_MESSAGE_PARSE_ERROR (-0x1202)
864 
865 #if defined(__cplusplus)
866 }
867 #endif
868 
869 #endif /* #ifndef _AIOT_STATE_API_H_ */
870 
int32_t aiot_state_set_log_level(log_level_t level)
设置SDK的日志信息输出等级
int32_t aiot_state_set_logcb(aiot_state_logcb_t handler)
设置SDK的日志信息输出使用的回调函数
Definition: aiot_state_api.h:35
Definition: aiot_state_api.h:37
log_level_t
Definition: aiot_state_api.h:33
Definition: aiot_state_api.h:36
Definition: aiot_state_api.h:34
int32_t(* aiot_state_logcb_t)(int32_t code, char *message)
SDK的日志信息输出回调函数原型
Definition: aiot_state_api.h:22