37#if (defined _WINDOWS || defined WIN32 || defined _MSC_VER) && (!defined MINGW && !defined __MINGW32__ && !defined __MINGW64__)
42# if defined OPENZWAVE_MAKEDLL
43# define OPENZWAVE_EXPORT __declspec(dllexport)
44 __pragma(warning(disable: 4251)) __pragma(warning(disable: 4275))
45# elif defined OPENZWAVE_USEDLL
47 __pragma(warning(disable: 4251)) __pragma(warning(disable: 4275))
57#elif defined(_MSC_VER)
60#pragma message(
"WARNING: You need to implement DEPRECATED for this compiler")
66 __pragma( warning(disable: 4996) )
69 _Pragma (
"GCC diagnostic ignored \"-Wdeprecated-declarations\"" )
94typedef signed __int64 int64;
95typedef unsigned __int64 uint64;
99typedef signed long long int64;
100typedef unsigned long long uint64;
116static inline uint16_t version_major(
struct ozwversion v)
118 return (v.
_v & 0xFFFF0000) >> 16;
126static inline uint16_t version_minor(
const struct ozwversion &v)
128 return v.
_v & 0xFFFF;
137static inline struct ozwversion version(uint16_t major, uint16_t minor)
140 v.
_v = (uint32_t) (major << 16) | (uint32_t) minor;
159 return (a.
_v == b.
_v) ? 0 : (a.
_v > b.
_v) ? 1 : -1;
164# define __MYFUNCTION__ __FUNCTION__
166# define __MYFUNCTION__ __FILE__
169# 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); \
170 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg)
171# 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); \
172 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg)
200#define snprintf sprintf_s
201#define strcasecmp _stricmp
202#define sscanf sscanf_s
203#define strncpy(x, y, z) strncpy_s(x, sizeof(x), y, sizeof(x)-1)
204#define strncat strncat_s
212#define sprintf_s snprintf
225#define MAX_MAX_TRIES 7
226#define ACK_TIMEOUT 1000
227#define BYTE_TIMEOUT 150
229#define RETRY_TIMEOUT 10000
236#define NUM_NODE_BITFIELD_BYTES 29
241#define ZW_CLOCK_SET 0x30
243#define TRANSMIT_OPTION_ACK 0x01
244#define TRANSMIT_OPTION_LOW_POWER 0x02
245#define TRANSMIT_OPTION_AUTO_ROUTE 0x04
246#define TRANSMIT_OPTION_NO_ROUTE 0x10
247#define TRANSMIT_OPTION_EXPLORE 0x20
249#define TRANSMIT_COMPLETE_OK 0x00
250#define TRANSMIT_COMPLETE_NO_ACK 0x01
251#define TRANSMIT_COMPLETE_FAIL 0x02
252#define TRANSMIT_COMPLETE_NOT_IDLE 0x03
253#define TRANSMIT_COMPLETE_NOROUTE 0x04
254#define TRANSMIT_COMPLETE_VERIFIED 0x05
256#define RECEIVE_STATUS_ROUTED_BUSY 0x01
257#define RECEIVE_STATUS_TYPE_BROAD 0x04
259#define FUNC_ID_SERIAL_API_GET_INIT_DATA 0x02
260#define FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION 0x03
261#define FUNC_ID_APPLICATION_COMMAND_HANDLER 0x04
262#define FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES 0x05
263#define FUNC_ID_SERIAL_API_SET_TIMEOUTS 0x06
264#define FUNC_ID_SERIAL_API_GET_CAPABILITIES 0x07
265#define FUNC_ID_SERIAL_API_SOFT_RESET 0x08
267#define FUNC_ID_SERIAL_API_SETUP 0x0b
269#define FUNC_ID_ZW_SEND_NODE_INFORMATION 0x12
270#define FUNC_ID_ZW_SEND_DATA 0x13
271#define FUNC_ID_ZW_GET_VERSION 0x15
272#define FUNC_ID_ZW_R_F_POWER_LEVEL_SET 0x17
273#define FUNC_ID_ZW_GET_RANDOM 0x1c
274#define FUNC_ID_ZW_MEMORY_GET_ID 0x20
275#define FUNC_ID_MEMORY_GET_BYTE 0x21
276#define FUNC_ID_ZW_READ_MEMORY 0x23
278#define FUNC_ID_ZW_SET_LEARN_NODE_STATE 0x40
279#define FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO 0x41
280#define FUNC_ID_ZW_SET_DEFAULT 0x42
281#define FUNC_ID_ZW_NEW_CONTROLLER 0x43
282#define FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE 0x44
283#define FUNC_ID_ZW_REPLICATION_SEND_DATA 0x45
284#define FUNC_ID_ZW_ASSIGN_RETURN_ROUTE 0x46
285#define FUNC_ID_ZW_DELETE_RETURN_ROUTE 0x47
286#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 0x48
287#define FUNC_ID_ZW_APPLICATION_UPDATE 0x49
288#define FUNC_ID_ZW_ADD_NODE_TO_NETWORK 0x4a
289#define FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK 0x4b
290#define FUNC_ID_ZW_CREATE_NEW_PRIMARY 0x4c
291#define FUNC_ID_ZW_CONTROLLER_CHANGE 0x4d
292#define FUNC_ID_ZW_SET_LEARN_MODE 0x50
293#define FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE 0x51
294#define FUNC_ID_ZW_ENABLE_SUC 0x52
295#define FUNC_ID_ZW_REQUEST_NETWORK_UPDATE 0x53
296#define FUNC_ID_ZW_SET_SUC_NODE_ID 0x54
297#define FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE 0x55
298#define FUNC_ID_ZW_GET_SUC_NODE_ID 0x56
299#define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTIONS 0x5a
300#define FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION 0x5e
301#define FUNC_ID_ZW_REQUEST_NODE_INFO 0x60
302#define FUNC_ID_ZW_REMOVE_FAILED_NODE_ID 0x61
303#define FUNC_ID_ZW_IS_FAILED_NODE_ID 0x62
304#define FUNC_ID_ZW_REPLACE_FAILED_NODE 0x63
305#define FUNC_ID_ZW_GET_ROUTING_INFO 0x80
306#define FUNC_ID_SERIAL_API_SLAVE_NODE_INFO 0xA0
307#define FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER 0xA1
308#define FUNC_ID_ZW_SEND_SLAVE_NODE_INFO 0xA2
309#define FUNC_ID_ZW_SEND_SLAVE_DATA 0xA3
310#define FUNC_ID_ZW_SET_SLAVE_LEARN_MODE 0xA4
311#define FUNC_ID_ZW_GET_VIRTUAL_NODES 0xA5
312#define FUNC_ID_ZW_IS_VIRTUAL_NODE 0xA6
313#define FUNC_ID_ZW_SET_PROMISCUOUS_MODE 0xD0
314#define FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER 0xD1
316#define FUNC_ID_PROPRIETARY_0 0xF0
317#define FUNC_ID_PROPRIETARY_1 0xF1
318#define FUNC_ID_PROPRIETARY_2 0xF2
319#define FUNC_ID_PROPRIETARY_3 0xF3
320#define FUNC_ID_PROPRIETARY_4 0xF4
321#define FUNC_ID_PROPRIETARY_5 0xF5
322#define FUNC_ID_PROPRIETARY_6 0xF6
323#define FUNC_ID_PROPRIETARY_7 0xF7
324#define FUNC_ID_PROPRIETARY_8 0xF8
325#define FUNC_ID_PROPRIETARY_9 0xF9
326#define FUNC_ID_PROPRIETARY_A 0xFA
327#define FUNC_ID_PROPRIETARY_B 0xFB
328#define FUNC_ID_PROPRIETARY_C 0xFC
329#define FUNC_ID_PROPRIETARY_D 0xFD
330#define FUNC_ID_PROPRIETARY_E 0xFE
332#define ADD_NODE_ANY 0x01
333#define ADD_NODE_CONTROLLER 0x02
334#define ADD_NODE_SLAVE 0x03
335#define ADD_NODE_EXISTING 0x04
336#define ADD_NODE_STOP 0x05
337#define ADD_NODE_STOP_FAILED 0x06
339#define ADD_NODE_STATUS_LEARN_READY 0x01
340#define ADD_NODE_STATUS_NODE_FOUND 0x02
341#define ADD_NODE_STATUS_ADDING_SLAVE 0x03
342#define ADD_NODE_STATUS_ADDING_CONTROLLER 0x04
343#define ADD_NODE_STATUS_PROTOCOL_DONE 0x05
344#define ADD_NODE_STATUS_DONE 0x06
345#define ADD_NODE_STATUS_FAILED 0x07
347#define REMOVE_NODE_ANY 0x01
348#define REMOVE_NODE_CONTROLLER 0x02
349#define REMOVE_NODE_SLAVE 0x03
350#define REMOVE_NODE_STOP 0x05
352#define REMOVE_NODE_STATUS_LEARN_READY 0x01
353#define REMOVE_NODE_STATUS_NODE_FOUND 0x02
354#define REMOVE_NODE_STATUS_REMOVING_SLAVE 0x03
355#define REMOVE_NODE_STATUS_REMOVING_CONTROLLER 0x04
356#define REMOVE_NODE_STATUS_DONE 0x06
357#define REMOVE_NODE_STATUS_FAILED 0x07
359#define CREATE_PRIMARY_START 0x02
360#define CREATE_PRIMARY_STOP 0x05
361#define CREATE_PRIMARY_STOP_FAILED 0x06
363#define CONTROLLER_CHANGE_START 0x02
364#define CONTROLLER_CHANGE_STOP 0x05
365#define CONTROLLER_CHANGE_STOP_FAILED 0x06
367#define LEARN_MODE_STARTED 0x01
368#define LEARN_MODE_DONE 0x06
369#define LEARN_MODE_FAILED 0x07
370#define LEARN_MODE_DELETED 0x80
372#define REQUEST_NEIGHBOR_UPDATE_STARTED 0x21
373#define REQUEST_NEIGHBOR_UPDATE_DONE 0x22
374#define REQUEST_NEIGHBOR_UPDATE_FAILED 0x23
376#define FAILED_NODE_OK 0x00
377#define FAILED_NODE_REMOVED 0x01
378#define FAILED_NODE_NOT_REMOVED 0x02
380#define FAILED_NODE_REPLACE_WAITING 0x03
381#define FAILED_NODE_REPLACE_DONE 0x04
382#define FAILED_NODE_REPLACE_FAILED 0x05
384#define FAILED_NODE_REMOVE_STARTED 0x00
385#define FAILED_NODE_NOT_PRIMARY_CONTROLLER 0x02
386#define FAILED_NODE_NO_CALLBACK_FUNCTION 0x04
387#define FAILED_NODE_NOT_FOUND 0x08
388#define FAILED_NODE_REMOVE_PROCESS_BUSY 0x10
389#define FAILED_NODE_REMOVE_FAIL 0x20
391#define SUC_UPDATE_DONE 0x00
392#define SUC_UPDATE_ABORT 0x01
393#define SUC_UPDATE_WAIT 0x02
394#define SUC_UPDATE_DISABLED 0x03
395#define SUC_UPDATE_OVERFLOW 0x04
397#define SUC_FUNC_BASIC_SUC 0x00
398#define SUC_FUNC_NODEID_SERVER 0x01
400#define UPDATE_STATE_NODE_INFO_RECEIVED 0x84
401#define UPDATE_STATE_NODE_INFO_REQ_DONE 0x82
402#define UPDATE_STATE_NODE_INFO_REQ_FAILED 0x81
403#define UPDATE_STATE_ROUTING_PENDING 0x80
404#define UPDATE_STATE_NEW_ID_ASSIGNED 0x40
405#define UPDATE_STATE_DELETE_DONE 0x20
406#define UPDATE_STATE_SUC_ID 0x10
408#define APPLICATION_NODEINFO_LISTENING 0x01
409#define APPLICATION_NODEINFO_OPTIONAL_FUNCTIONALITY 0x02
411#define SLAVE_ASSIGN_COMPLETE 0x00
412#define SLAVE_ASSIGN_NODEID_DONE 0x01
413#define SLAVE_ASSIGN_RANGE_INFO_UPDATE 0x02
415#define SLAVE_LEARN_MODE_DISABLE 0x00
416#define SLAVE_LEARN_MODE_ENABLE 0x01
417#define SLAVE_LEARN_MODE_ADD 0x02
418#define SLAVE_LEARN_MODE_REMOVE 0x03
420#define OPTION_HIGH_POWER 0x80
421#define OPTION_NWI 0x40
423#define BASIC_SET 0x01
424#define BASIC_REPORT 0x03
426#define COMMAND_CLASS_BASIC 0x20
427#define COMMAND_CLASS_CONTROLLER_REPLICATION 0x21
428#define COMMAND_CLASS_APPLICATION_STATUS 0x22
429#define COMMAND_CLASS_HAIL 0x82
432#define ZW_LIB_CONTROLLER_STATIC 0x01
433#define ZW_LIB_CONTROLLER 0x02
434#define ZW_LIB_SLAVE_ENHANCED 0x03
435#define ZW_LIB_SLAVE 0x04
436#define ZW_LIB_INSTALLER 0x05
437#define ZW_LIB_SLAVE_ROUTING 0x06
438#define ZW_LIB_CONTROLLER_BRIDGE 0x07
439#define ZW_LIB_DUT 0x08
442#define SERIAL_API_SETUP_CMD_TX_STATUS_REPORT 0x02
443#define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET 0x04
444#define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_GET 0x08
445#define SERIAL_API_SETUP_CMD_TX_GET_MAX_PAYLOAD_SIZE 0x10
unsigned short uint16
Definition Defs.h:88
#define NULL
Definition Defs.h:81
unsigned int uint32
Definition Defs.h:91
signed char int8
Definition Defs.h:84
double float64
Definition Defs.h:104
signed short int16
Definition Defs.h:87
signed int int32
Definition Defs.h:90
#define OPENZWAVE_DEPRECATED_WARNINGS_ON
Definition Defs.h:75
TXSTATUS_ROUTING_SCHEME
Definition Defs.h:449
@ ROUTINGSCHEME_ROUTE
Definition Defs.h:455
@ ROUTINGSCHEME_CACHED_ROUTE_NLWR
Definition Defs.h:454
@ ROUTINGSCHEME_RESORT_EXPLORE
Definition Defs.h:457
@ ROUTINGSCHEME_CACHED_ROUTE_SR
Definition Defs.h:452
@ ROUTINGSCHEME_RESORT_DIRECT
Definition Defs.h:456
@ ROUTINGSCHEME_DIRECT
Definition Defs.h:451
@ ROUTINGSCHEME_IDLE
Definition Defs.h:450
@ ROUTINGSCHEME_CACHED_ROUTE
Definition Defs.h:453
struct ozwversion ozwversion
TXSTATUS_ROUTE_SPEED
Definition Defs.h:462
@ ROUTE_SPEED_9600
Definition Defs.h:464
@ ROUTE_SPEED_40K
Definition Defs.h:465
@ ROUTE_SPEED_100K
Definition Defs.h:466
@ ROUTE_SPEED_AUTO
Definition Defs.h:463
float float32
Definition Defs.h:103
#define OPENZWAVE_EXPORT
Definition Defs.h:52
#define DEPRECATED
Definition Defs.h:61
unsigned char uint8
Definition Defs.h:85
#define OPENZWAVE_DEPRECATED_WARNINGS_OFF
Definition Defs.h:68
Definition Bitfield.cpp:31
uint32_t _v
Definition Defs.h:108