1 //******************************************************************
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This API only works with:
40 #define DEVICE_BAUDRATE (B19200)
41 #define MAX_ZIGBEE_BYTES (512)
42 #define MAX_ZIGBEE_ENROLLED_DEVICES (255)
44 #define TIME_OUT_00_SECOND (0)
45 #define TIME_OUT_01_SECOND (1)
46 #define TIME_OUT_05_SECONDS (5)
47 #define TIME_OUT_07_SECONDS (7)
48 #define TIME_OUT_10_SECONDS (10)
49 #define TIME_OUT_15_SECONDS (15)
51 #define SIMPLEDESC_RESPONSE_EXPECTED_LINES (6)
53 #define AT_STR_ERROR_OK "00"
54 #define AT_STR_ERROR_INVALID_OP "70"
56 #define AT_STR_ERROR_EVERYTHING_OK "00"
57 #define AT_STR_ERROR_NODE_IS_PART_OF_PAN "28"
58 #define AT_STR_ERROR_MESSAGE_NOT_SENT_TO_TARGET_SUCCESSFULLY "66"
59 #define AT_STR_ERROR_INVALID_OPERATION "70"
64 #define SEPARATOR_LENGTH strlen(SEPARATOR)
66 #define AT_CMD_RESET "AT&F"
67 #define AT_CMD_GET_NETWORK_INFO "AT+N"
68 #define AT_CMD_ESTABLISH_NETWORK "AT+EN"
69 #define AT_CMD_PERMIT_JOIN "AT+PJOIN:"
70 #define AT_CMD_MATCH_REQUEST "AT+MATCHREQ:"
71 #define AT_CMD_SIMPLE_DESC "AT+SIMPLEDESC:"
72 #define AT_CMD_WRITE_ATR "AT+WRITEATR:"
73 #define AT_CMD_READ_ATR "AT+READATR:"
74 #define AT_CMD_RUN_ON_OFF "AT+RONOFF:"
75 #define AT_CMD_MOVE_TO_LEVEL "AT+LCMVTOLEV:"
76 #define AT_CMD_DOOR_LOCK "AT+DRLOCK:"
77 #define AT_CMD_COLOR_CTRL_MOVE_TO_COLOR_TEMPERATURE "AT+CCMVTOCT:"
78 #define AT_CMD_GET_LOCAL_EUI "ATS04?"
79 #define AT_CMD_REMOTE_EUI_REQUEST "AT+EUIREQ:"
81 #define TW_ENDCONTROL_ERROR_STRING "ERROR:"
84 #define SIZE_NODEID (5)
85 #define SIZE_CLUSTERID (5)
86 #define SIZE_ENDPOINTID (3)
88 #define SIZE_ZONESTATUS (5)
89 #define SIZE_ZONESTATUS_EXTENDED (3)
90 #define SIZE_ZONEID (3)
91 #define SIZE_ZONETYPE (5)
92 #define SIZE_UPDATE_DELAY_TIME (5)
94 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
109 char* remoteAttributeValueRead;
110 uint8_t remoteAtrributeValueReadLength;
117 TW_RESULT_ERROR_LINE_COUNT,
118 TW_RESULT_NO_LOCAL_PAN,
119 TW_RESULT_HAS_LOCAL_PAN,
120 TW_RESULT_NEW_LOCAL_PAN_ESTABLISHED,
121 TW_RESULT_DEVICE_JOINED,
122 TW_RESULT_FOUND_NO_MATCHED_DEVICE,
123 TW_RESULT_FOUND_MATCHED_DEVICES,
124 TW_RESULT_HAS_CLUSTERS,
125 TW_RESULT_HAS_NO_CLUSTER,
126 TW_RESULT_REMOTE_ATTR_HAS_VALUE,
130 TW_RESULT_ERROR_INVALID_PARAMS,
131 TW_RESULT_ERROR_INVALID_PORT,
132 TW_RESULT_ERROR_NO_MEMORY,
133 TW_RESULT_ERROR_INVALID_OP,
134 TW_RESULT_ERROR_NOTIMPL,
136 TW_RESULT_ERROR = 255
142 AT_ERROR_EVERYTHING_OK = 0,
143 AT_ERROR_NODE_IS_PART_OF_PAN = 28,
144 AT_ERROR_MESSAGE_NOT_SENT_TO_TARGET_SUCCESSFULLY = 66,
145 AT_ERROR_INVALID_OPERATION = 70,
151 TW_ENDCONTROL_OK = 0,
155 TW_ENDCONTROL_MAX_VALUE
162 TWEndControl endControl;
166 typedef TWResultCode (*TWATResultHandler)(int count, char** tokens);
170 const char *resultTxt;
171 TWATResultHandler handler;
173 } TWATResultHandlerPair;
177 #endif // __cplusplus
179 #endif /* TWTYPES_H_ */