37#if (defined _WINDOWS || defined WIN32 || defined _MSC_VER) && (!defined MINGW && !defined __MINGW32__ && !defined __MINGW64__)
38# if defined OPENZWAVE_MAKEDLL
39# define OPENZWAVE_EXPORT __declspec(dllexport)
40# elif defined OPENZWAVE_USEDLL
41# define OPENZWAVE_EXPORT __declspec(dllimport)
43# define OPENZWAVE_EXPORT
46# define OPENZWAVE_EXPORT_WARNINGS_OFF __pragma( warning(push) )\
47 __pragma( warning(disable: 4251) ) \
48 __pragma( warning(disable: 4275) )
49# define OPENZWAVE_EXPORT_WARNINGS_ON __pragma( warning(pop) )
51# define OPENZWAVE_EXPORT
52# define OPENZWAVE_EXPORT_WARNINGS_OFF
53# define OPENZWAVE_EXPORT_WARNINGS_ON
57#define DEPRECATED __attribute__((deprecated))
58#elif defined(_MSC_VER)
59#define DEPRECATED __declspec(deprecated)
61#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
67#define OPENZWAVE_DEPRECATED_WARNINGS_OFF __pragma( warning(push) )\
68 __pragma( warning(disable: 4996) )
70#define OPENZWAVE_DEPRECATED_WARNINGS_OFF _Pragma ( "GCC diagnostic push" )\
71 _Pragma ( "GCC diagnostic ignored \"-Wdeprecated-declarations\"" )
75#define OPENZWAVE_DEPRECATED_WARNINGS_ON __pragma( warning(pop) )
77#define OPENZWAVE_DEPRECATED_WARNINGS_ON _Pragma ( "GCC diagnostic pop" )
98typedef signed __int64 int64;
99typedef unsigned __int64 uint64;
103typedef signed long long int64;
104typedef unsigned long long uint64;
119static inline uint16_t version_major(
struct ozwversion v) {
120 return (v.
_v & 0xFFFF0000) >> 16;
128static inline uint16_t version_minor(
const struct ozwversion &v) {
129 return v.
_v & 0xFFFF;
138static inline struct ozwversion version(uint16_t major, uint16_t minor)
141 v.
_v = (uint32_t)(major << 16) | (uint32_t)minor;
160 return (a.
_v == b.
_v) ? 0 : (a.
_v > b.
_v) ? 1 : - 1;
165# define __MYFUNCTION__ __FUNCTION__
167# define __MYFUNCTION__ __FILE__
170#ifdef OPENZWAVE_ENABLE_EXCEPTIONS
172# define OZW_FATAL_ERROR(exitCode, msg) Log::Write( LogLevel_Error,"Exception: %s:%d - %d - %s", std::string(__MYFUNCTION__).substr(std::string(__MYFUNCTION__).find_last_of("/\\") + 1).c_str(), __LINE__, exitCode, msg); \
173 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg)
174# define OZW_ERROR(exitCode, msg) Log::Write( LogLevel_Warning,"Exception: %s:%d - %d - %s", std::string(__MYFUNCTION__).substr(std::string(__MYFUNCTION__).find_last_of("/\\") + 1).c_str(), __LINE__, exitCode, msg); \
175 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg)
179# define OZW_FATAL_ERROR(exitCode, msg) Log::Write( LogLevel_Error,"Exception: %s:%d - %d - %s", std::string(__MYFUNCTION__).substr(std::string(__MYFUNCTION__).find_last_of("/\\") + 1).c_str(), __LINE__, exitCode, msg); \
180 std::cerr << "Error: "<< std::string(__MYFUNCTION__).substr(std::string(__MYFUNCTION__).find_last_of("/\\") + 1) << ":" << __LINE__ << " - " << msg << std::endl; exit(exitCode)
181# define OZW_ERROR(exitCode, msg) Log::Write( LogLevel_Warning,"Exception: %s:%d - %d - %s", std::string(__MYFUNCTION__).substr(std::string(__MYFUNCTION__).find_last_of("/\\") + 1).c_str(), __LINE__, exitCode, msg);
202#define snprintf sprintf_s
203#define strcasecmp _stricmp
204#define sscanf sscanf_s
205#define strncpy strncpy_s
206#define strncat strncat_s
216#define sprintf_s snprintf
230#define MAX_MAX_TRIES 7
231#define ACK_TIMEOUT 1000
232#define BYTE_TIMEOUT 150
234#define RETRY_TIMEOUT 10000
241#define NUM_NODE_BITFIELD_BYTES 29
246#define ZW_CLOCK_SET 0x30
248#define TRANSMIT_OPTION_ACK 0x01
249#define TRANSMIT_OPTION_LOW_POWER 0x02
250#define TRANSMIT_OPTION_AUTO_ROUTE 0x04
251#define TRANSMIT_OPTION_NO_ROUTE 0x10
252#define TRANSMIT_OPTION_EXPLORE 0x20
254#define TRANSMIT_COMPLETE_OK 0x00
255#define TRANSMIT_COMPLETE_NO_ACK 0x01
256#define TRANSMIT_COMPLETE_FAIL 0x02
257#define TRANSMIT_COMPLETE_NOT_IDLE 0x03
258#define TRANSMIT_COMPLETE_NOROUTE 0x04
259#define TRANSMIT_COMPLETE_VERIFIED 0x05
261#define RECEIVE_STATUS_ROUTED_BUSY 0x01
262#define RECEIVE_STATUS_TYPE_BROAD 0x04
264#define FUNC_ID_SERIAL_API_GET_INIT_DATA 0x02
265#define FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION 0x03
266#define FUNC_ID_APPLICATION_COMMAND_HANDLER 0x04
267#define FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES 0x05
268#define FUNC_ID_SERIAL_API_SET_TIMEOUTS 0x06
269#define FUNC_ID_SERIAL_API_GET_CAPABILITIES 0x07
270#define FUNC_ID_SERIAL_API_SOFT_RESET 0x08
272#define FUNC_ID_SERIAL_API_SETUP 0x0b
274#define FUNC_ID_ZW_SEND_NODE_INFORMATION 0x12
275#define FUNC_ID_ZW_SEND_DATA 0x13
276#define FUNC_ID_ZW_GET_VERSION 0x15
277#define FUNC_ID_ZW_R_F_POWER_LEVEL_SET 0x17
278#define FUNC_ID_ZW_GET_RANDOM 0x1c
279#define FUNC_ID_ZW_MEMORY_GET_ID 0x20
280#define FUNC_ID_MEMORY_GET_BYTE 0x21
281#define FUNC_ID_ZW_READ_MEMORY 0x23
283#define FUNC_ID_ZW_SET_LEARN_NODE_STATE 0x40
284#define FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO 0x41
285#define FUNC_ID_ZW_SET_DEFAULT 0x42
286#define FUNC_ID_ZW_NEW_CONTROLLER 0x43
287#define FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE 0x44
288#define FUNC_ID_ZW_REPLICATION_SEND_DATA 0x45
289#define FUNC_ID_ZW_ASSIGN_RETURN_ROUTE 0x46
290#define FUNC_ID_ZW_DELETE_RETURN_ROUTE 0x47
291#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 0x48
292#define FUNC_ID_ZW_APPLICATION_UPDATE 0x49
293#define FUNC_ID_ZW_ADD_NODE_TO_NETWORK 0x4a
294#define FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK 0x4b
295#define FUNC_ID_ZW_CREATE_NEW_PRIMARY 0x4c
296#define FUNC_ID_ZW_CONTROLLER_CHANGE 0x4d
297#define FUNC_ID_ZW_SET_LEARN_MODE 0x50
298#define FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE 0x51
299#define FUNC_ID_ZW_ENABLE_SUC 0x52
300#define FUNC_ID_ZW_REQUEST_NETWORK_UPDATE 0x53
301#define FUNC_ID_ZW_SET_SUC_NODE_ID 0x54
302#define FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE 0x55
303#define FUNC_ID_ZW_GET_SUC_NODE_ID 0x56
304#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTIONS 0x5a
305#define FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION 0x5e
306#define FUNC_ID_ZW_REQUEST_NODE_INFO 0x60
307#define FUNC_ID_ZW_REMOVE_FAILED_NODE_ID 0x61
308#define FUNC_ID_ZW_IS_FAILED_NODE_ID 0x62
309#define FUNC_ID_ZW_REPLACE_FAILED_NODE 0x63
310#define FUNC_ID_ZW_GET_ROUTING_INFO 0x80
311#define FUNC_ID_SERIAL_API_SLAVE_NODE_INFO 0xA0
312#define FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER 0xA1
313#define FUNC_ID_ZW_SEND_SLAVE_NODE_INFO 0xA2
314#define FUNC_ID_ZW_SEND_SLAVE_DATA 0xA3
315#define FUNC_ID_ZW_SET_SLAVE_LEARN_MODE 0xA4
316#define FUNC_ID_ZW_GET_VIRTUAL_NODES 0xA5
317#define FUNC_ID_ZW_IS_VIRTUAL_NODE 0xA6
318#define FUNC_ID_ZW_SET_PROMISCUOUS_MODE 0xD0
319#define FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER 0xD1
321#define FUNC_ID_PROPRIETARY_0 0xF0
322#define FUNC_ID_PROPRIETARY_1 0xF1
323#define FUNC_ID_PROPRIETARY_2 0xF2
324#define FUNC_ID_PROPRIETARY_3 0xF3
325#define FUNC_ID_PROPRIETARY_4 0xF4
326#define FUNC_ID_PROPRIETARY_5 0xF5
327#define FUNC_ID_PROPRIETARY_6 0xF6
328#define FUNC_ID_PROPRIETARY_7 0xF7
329#define FUNC_ID_PROPRIETARY_8 0xF8
330#define FUNC_ID_PROPRIETARY_9 0xF9
331#define FUNC_ID_PROPRIETARY_A 0xFA
332#define FUNC_ID_PROPRIETARY_B 0xFB
333#define FUNC_ID_PROPRIETARY_C 0xFC
334#define FUNC_ID_PROPRIETARY_D 0xFD
335#define FUNC_ID_PROPRIETARY_E 0xFE
338#define ADD_NODE_ANY 0x01
339#define ADD_NODE_CONTROLLER 0x02
340#define ADD_NODE_SLAVE 0x03
341#define ADD_NODE_EXISTING 0x04
342#define ADD_NODE_STOP 0x05
343#define ADD_NODE_STOP_FAILED 0x06
345#define ADD_NODE_STATUS_LEARN_READY 0x01
346#define ADD_NODE_STATUS_NODE_FOUND 0x02
347#define ADD_NODE_STATUS_ADDING_SLAVE 0x03
348#define ADD_NODE_STATUS_ADDING_CONTROLLER 0x04
349#define ADD_NODE_STATUS_PROTOCOL_DONE 0x05
350#define ADD_NODE_STATUS_DONE 0x06
351#define ADD_NODE_STATUS_FAILED 0x07
353#define REMOVE_NODE_ANY 0x01
354#define REMOVE_NODE_CONTROLLER 0x02
355#define REMOVE_NODE_SLAVE 0x03
356#define REMOVE_NODE_STOP 0x05
358#define REMOVE_NODE_STATUS_LEARN_READY 0x01
359#define REMOVE_NODE_STATUS_NODE_FOUND 0x02
360#define REMOVE_NODE_STATUS_REMOVING_SLAVE 0x03
361#define REMOVE_NODE_STATUS_REMOVING_CONTROLLER 0x04
362#define REMOVE_NODE_STATUS_DONE 0x06
363#define REMOVE_NODE_STATUS_FAILED 0x07
365#define CREATE_PRIMARY_START 0x02
366#define CREATE_PRIMARY_STOP 0x05
367#define CREATE_PRIMARY_STOP_FAILED 0x06
369#define CONTROLLER_CHANGE_START 0x02
370#define CONTROLLER_CHANGE_STOP 0x05
371#define CONTROLLER_CHANGE_STOP_FAILED 0x06
373#define LEARN_MODE_STARTED 0x01
374#define LEARN_MODE_DONE 0x06
375#define LEARN_MODE_FAILED 0x07
376#define LEARN_MODE_DELETED 0x80
378#define REQUEST_NEIGHBOR_UPDATE_STARTED 0x21
379#define REQUEST_NEIGHBOR_UPDATE_DONE 0x22
380#define REQUEST_NEIGHBOR_UPDATE_FAILED 0x23
382#define FAILED_NODE_OK 0x00
383#define FAILED_NODE_REMOVED 0x01
384#define FAILED_NODE_NOT_REMOVED 0x02
386#define FAILED_NODE_REPLACE_WAITING 0x03
387#define FAILED_NODE_REPLACE_DONE 0x04
388#define FAILED_NODE_REPLACE_FAILED 0x05
390#define FAILED_NODE_REMOVE_STARTED 0x00
391#define FAILED_NODE_NOT_PRIMARY_CONTROLLER 0x02
392#define FAILED_NODE_NO_CALLBACK_FUNCTION 0x04
393#define FAILED_NODE_NOT_FOUND 0x08
394#define FAILED_NODE_REMOVE_PROCESS_BUSY 0x10
395#define FAILED_NODE_REMOVE_FAIL 0x20
397#define SUC_UPDATE_DONE 0x00
398#define SUC_UPDATE_ABORT 0x01
399#define SUC_UPDATE_WAIT 0x02
400#define SUC_UPDATE_DISABLED 0x03
401#define SUC_UPDATE_OVERFLOW 0x04
403#define SUC_FUNC_BASIC_SUC 0x00
404#define SUC_FUNC_NODEID_SERVER 0x01
406#define UPDATE_STATE_NODE_INFO_RECEIVED 0x84
407#define UPDATE_STATE_NODE_INFO_REQ_DONE 0x82
408#define UPDATE_STATE_NODE_INFO_REQ_FAILED 0x81
409#define UPDATE_STATE_ROUTING_PENDING 0x80
410#define UPDATE_STATE_NEW_ID_ASSIGNED 0x40
411#define UPDATE_STATE_DELETE_DONE 0x20
412#define UPDATE_STATE_SUC_ID 0x10
414#define APPLICATION_NODEINFO_LISTENING 0x01
415#define APPLICATION_NODEINFO_OPTIONAL_FUNCTIONALITY 0x02
417#define SLAVE_ASSIGN_COMPLETE 0x00
418#define SLAVE_ASSIGN_NODEID_DONE 0x01
419#define SLAVE_ASSIGN_RANGE_INFO_UPDATE 0x02
421#define SLAVE_LEARN_MODE_DISABLE 0x00
422#define SLAVE_LEARN_MODE_ENABLE 0x01
423#define SLAVE_LEARN_MODE_ADD 0x02
424#define SLAVE_LEARN_MODE_REMOVE 0x03
426#define OPTION_HIGH_POWER 0x80
427#define OPTION_NWI 0x40
429#define BASIC_SET 0x01
430#define BASIC_REPORT 0x03
432#define COMMAND_CLASS_BASIC 0x20
433#define COMMAND_CLASS_CONTROLLER_REPLICATION 0x21
434#define COMMAND_CLASS_APPLICATION_STATUS 0x22
435#define COMMAND_CLASS_HAIL 0x82
438#define ZW_LIB_CONTROLLER_STATIC 0x01
439#define ZW_LIB_CONTROLLER 0x02
440#define ZW_LIB_SLAVE_ENHANCED 0x03
441#define ZW_LIB_SLAVE 0x04
442#define ZW_LIB_INSTALLER 0x05
443#define ZW_LIB_SLAVE_ROUTING 0x06
444#define ZW_LIB_CONTROLLER_BRIDGE 0x07
445#define ZW_LIB_DUT 0x08
448#define SERIAL_API_SETUP_CMD_TX_STATUS_REPORT 0x02
449#define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET 0x04
450#define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_GET 0x08
451#define SERIAL_API_SETUP_CMD_TX_GET_MAX_PAYLOAD_SIZE 0x10
unsigned short uint16
Definition: Defs.h:92
unsigned int uint32
Definition: Defs.h:95
signed char int8
Definition: Defs.h:88
double float64
Definition: Defs.h:108
signed short int16
Definition: Defs.h:91
signed int int32
Definition: Defs.h:94
TXSTATUS_ROUTING_SCHEME
Definition: Defs.h:455
@ ROUTINGSCHEME_ROUTE
Definition: Defs.h:461
@ ROUTINGSCHEME_CACHED_ROUTE_NLWR
Definition: Defs.h:460
@ ROUTINGSCHEME_RESORT_EXPLORE
Definition: Defs.h:463
@ ROUTINGSCHEME_CACHED_ROUTE_SR
Definition: Defs.h:458
@ ROUTINGSCHEME_RESORT_DIRECT
Definition: Defs.h:462
@ ROUTINGSCHEME_DIRECT
Definition: Defs.h:457
@ ROUTINGSCHEME_IDLE
Definition: Defs.h:456
@ ROUTINGSCHEME_CACHED_ROUTE
Definition: Defs.h:459
struct ozwversion ozwversion
TXSTATUS_ROUTE_SPEED
Definition: Defs.h:468
@ ROUTE_SPEED_9600
Definition: Defs.h:470
@ ROUTE_SPEED_40K
Definition: Defs.h:471
@ ROUTE_SPEED_100K
Definition: Defs.h:472
@ ROUTE_SPEED_AUTO
Definition: Defs.h:469
float float32
Definition: Defs.h:107
unsigned char uint8
Definition: Defs.h:89
Definition: Bitfield.h:35
uint32_t _v
Definition: Defs.h:111