1 /*
2  * Copyright (C) 2015-2019 Alibaba Group Holding Limited
3  */
4 #ifndef UAGENT_CONFIG_H
5 #define UAGENT_CONFIG_H
6 
7 #define PK_STR_SIZE 16 /* PK LEN currently is 11 */
8 #define DN_STR_SIZE 36 /* DN LEN currently is 32 */
9 
10 /* 11Bytes PK + MAX 32bytes DN + payload */
11 #define UAGENT_TOPIC_MAX_LEN 64
12 /* uagent support main service in max */
13 #define UAGENT_SERVICE_SIZE  32
14 
15 /* uagent support mod in max, uLog uND uOTA CLI */
16 #define UAGENT_MOD_SIZE                 8
17 #define UAGENT_PAYLOAD_CMD_SIZE         520
18 #define UAGENT_PAYLOAD_CMD_STR_SIZE     512
19 #define UAGENT_QUEUE_COUNT              4
20 
21 #ifndef UAGENT_CONFIG_INFO_PAYLOAD_SIZE
22 #define UAGENT_INFO_PAYLOAD_SIZE        1200
23 #else
24 #define UAGENT_INFO_PAYLOAD_SIZE        UAGENT_CONFIG_INFO_PAYLOAD_SIZE
25 #endif
26 #define UAGENT_INFO_PAYLOAD_BASE64_SIZE 1000
27 
28 #define UAGENT_INFO_NEAR_FULL           600
29 #define UAGENT_ROUTINE_TASK_STACK_DEPTH 4096
30 
31 #define UAGENT_INITED     (char)1
32 #define UAGENT_REGISTER   (char)1
33 #define UAGENT_UNREGISTER (char)0
34 
35 #define UAGENT_CHECK_COMM_CYCLE 200
36 #define UAGENT_WAIT_BUFFER      500
37 
38 #define UAGENT_MSG_IDX_INVALID 0xFFFFFFFF
39 
40 #define TOPIC_AGENT_MAN  "/sys/%s/%s/_thing/service/invoke"
41 
42 #define TOPIC_AGENT_POST_REPLY "/sys/%s/%s/_thing/service/post_reply"
43 
44 #define TOPIC_AGENT_INFO "/sys/%s/%s/_thing/service/post"
45 
46 #define UAGENT_LOG_TAG   "AGENT"
47 
48 #define UAGENT_INFO_STR \
49 "{\"id\":%lu, \"version\":\"1.0\",\
50 \"params\":\
51 {\"identifier\": \"_Devops.alios.uagent\",\
52  \"serviceParams\": \
53 {\"id\":%lu, \"srcdev\":\"%s\",\"show\":%d,\"mod\":%d,\"func\":%d,\"param\":\"%s\"},\
54 \"method\": \"_thing.service.post\"\
55 }}"
56 
57 #define UAGENT_FORMAT_PRE \
58 "{\"id\":%lu, \"version\":\"1.0\",\
59 \"method\": \"_thing.service.post\",\
60 \"params\":\
61 {\"identifier\": \"_Devops.alios.uagent\",\
62  \"serviceParams\": \
63 {\"id\":%lu, \"srcdev\":\"%s\",\"show\":%d,\"mod\":%d,\"func\":%d,\"param\":"
64 
65 #define UAGENT_FORMAT_STR_SUFFIX "\"}}}"
66 
67 #define UAGENT_FORMAT_OBJ_SUFFIX "}}}"
68 
69 #define UAGENT_INFO_ACK_OK \
70 "{\"id\":%lu, \"version\":\"1.0\",\
71 \"params\":\
72 {\"identifier\": \"_Devops.alios.uagent\",\
73  \"serviceParams\": \
74 {\"srcdev\":\"%s\",\"show\":%d,\"mod\":%d,\"func\":%d,\"ack\":%d, \"id\":%lu},\
75 \"method\": \"_thing.service.post\"\
76 }}"
77 
78 #define UAGENT_INFO_ACK_FAIL \
79 "{\"id\":%lu, \"version\":\"1.0\",\"params\":\
80 {\"identifier\": \"_Devops.alios.uagent\",\
81  \"serviceParams\": \
82 {\"srcdev\":\"%s\",\"show\":%d,\"mod\":%d,\"func\":%d,\"ack\":%d, \"param\":\"%s\", \"id\":%lu},\
83 \"method\": \"_thing.service.post\"\
84 }}"
85 
86 #endif /* !UAGENT_CONFIG_H */
87