37 #if (defined _WINDOWS || defined WIN32 || defined _MSC_VER) && (!defined MINGW && !defined __MINGW32__ && !defined __MINGW64__) 38 # if defined OPENZWAVE_MAKEDLL // Create the dynamic library. 39 # define OPENZWAVE_EXPORT __declspec(dllexport) 40 # elif defined OPENZWAVE_USEDLL // Use the dynamic library 41 # define OPENZWAVE_EXPORT __declspec(dllimport) 42 # else // Create/Use the static library 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") 66 #define OPENZWAVE_DEPRECATED_WARNINGS_OFF __pragma( warning(push) )\ 67 __pragma( warning(disable: 4996) ) 69 #define OPENZWAVE_DEPRECATED_WARNINGS_OFF _Pragma ( "GCC diagnostic push" )\ 70 _Pragma ( "GCC diagnostic ignored \"-Wdeprecated-declarations\"" ) 74 #define OPENZWAVE_DEPRECATED_WARNINGS_ON __pragma( warning(pop) ) 76 #define OPENZWAVE_DEPRECATED_WARNINGS_ON _Pragma ( "GCC diagnostic pop" ) 95 typedef signed __int64 int64;
96 typedef unsigned __int64 uint64;
100 typedef signed long long int64;
101 typedef unsigned long long uint64;
117 static inline uint16_t version_major(
struct ozwversion v)
119 return (v.
_v & 0xFFFF0000) >> 16;
127 static inline uint16_t version_minor(
const struct ozwversion &v)
129 return v.
_v & 0xFFFF;
138 static 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;
164 #if defined(_MSC_VER) 165 # define __MYFUNCTION__ __FUNCTION__ 167 # define __MYFUNCTION__ __FILE__ 170 # 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); \ 171 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg) 172 # 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); \ 173 throw OZWException(__MYFUNCTION__, __LINE__, exitCode, msg) 201 #define snprintf sprintf_s 202 #define strcasecmp _stricmp 203 #define sscanf sscanf_s 204 #define strncpy(x, y, z) strncpy_s(x, sizeof(x), y, sizeof(x)-1) 205 #define strncat strncat_s 213 #define sprintf_s snprintf 220 #define fopen_s fopen 225 #define MAX_TRIES 1 // set this to one, as I believe now that a ACK failure is indication that the device is offline, hence additional attempts will not work. 226 #define MAX_MAX_TRIES 7 // Don't exceed this retry limit 227 #define ACK_TIMEOUT 1000 // How long to wait for an ACK 228 #define BYTE_TIMEOUT 150 230 #define RETRY_TIMEOUT 10000 // Retry send after 10 seconds (we might need to keep this below 10 for Security CC to function correctly) 237 #define NUM_NODE_BITFIELD_BYTES 29 // 29 bytes = 232 bits, one for each possible node in the network. 240 #define RESPONSE 0x01 242 #define ZW_CLOCK_SET 0x30 244 #define TRANSMIT_OPTION_ACK 0x01 245 #define TRANSMIT_OPTION_LOW_POWER 0x02 246 #define TRANSMIT_OPTION_AUTO_ROUTE 0x04 247 #define TRANSMIT_OPTION_NO_ROUTE 0x10 248 #define TRANSMIT_OPTION_EXPLORE 0x20 250 #define TRANSMIT_COMPLETE_OK 0x00 251 #define TRANSMIT_COMPLETE_NO_ACK 0x01 252 #define TRANSMIT_COMPLETE_FAIL 0x02 253 #define TRANSMIT_COMPLETE_NOT_IDLE 0x03 254 #define TRANSMIT_COMPLETE_NOROUTE 0x04 255 #define TRANSMIT_COMPLETE_VERIFIED 0x05 257 #define RECEIVE_STATUS_ROUTED_BUSY 0x01 258 #define RECEIVE_STATUS_TYPE_BROAD 0x04 260 #define FUNC_ID_SERIAL_API_GET_INIT_DATA 0x02 261 #define FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION 0x03 262 #define FUNC_ID_APPLICATION_COMMAND_HANDLER 0x04 263 #define FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES 0x05 264 #define FUNC_ID_SERIAL_API_SET_TIMEOUTS 0x06 265 #define FUNC_ID_SERIAL_API_GET_CAPABILITIES 0x07 266 #define FUNC_ID_SERIAL_API_SOFT_RESET 0x08 268 #define FUNC_ID_SERIAL_API_SETUP 0x0b 270 #define FUNC_ID_ZW_SEND_NODE_INFORMATION 0x12 271 #define FUNC_ID_ZW_SEND_DATA 0x13 272 #define FUNC_ID_ZW_GET_VERSION 0x15 273 #define FUNC_ID_ZW_R_F_POWER_LEVEL_SET 0x17 274 #define FUNC_ID_ZW_GET_RANDOM 0x1c 275 #define FUNC_ID_ZW_MEMORY_GET_ID 0x20 276 #define FUNC_ID_MEMORY_GET_BYTE 0x21 277 #define FUNC_ID_ZW_READ_MEMORY 0x23 279 #define FUNC_ID_ZW_SET_LEARN_NODE_STATE 0x40 // Not implemented 280 #define FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO 0x41 // Get protocol info (baud rate, listening, etc.) for a given node 281 #define FUNC_ID_ZW_SET_DEFAULT 0x42 // Reset controller and node info to default (original) values 282 #define FUNC_ID_ZW_NEW_CONTROLLER 0x43 // Not implemented 283 #define FUNC_ID_ZW_REPLICATION_COMMAND_COMPLETE 0x44 // Replication send data complete 284 #define FUNC_ID_ZW_REPLICATION_SEND_DATA 0x45 // Replication send data 285 #define FUNC_ID_ZW_ASSIGN_RETURN_ROUTE 0x46 // Assign a return route from the specified node to the controller 286 #define FUNC_ID_ZW_DELETE_RETURN_ROUTE 0x47 // Delete all return routes from the specified node 287 #define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE 0x48 // Ask the specified node to update its neighbors (then read them from the controller) 288 #define FUNC_ID_ZW_APPLICATION_UPDATE 0x49 // Get a list of supported (and controller) command classes 289 #define FUNC_ID_ZW_ADD_NODE_TO_NETWORK 0x4a // Control the addnode (or addcontroller) process...start, stop, etc. 290 #define FUNC_ID_ZW_REMOVE_NODE_FROM_NETWORK 0x4b // Control the removenode (or removecontroller) process...start, stop, etc. 291 #define FUNC_ID_ZW_CREATE_NEW_PRIMARY 0x4c // Control the createnewprimary process...start, stop, etc. 292 #define FUNC_ID_ZW_CONTROLLER_CHANGE 0x4d // Control the transferprimary process...start, stop, etc. 293 #define FUNC_ID_ZW_SET_LEARN_MODE 0x50 // Put a controller into learn mode for replication/ receipt of configuration info 294 #define FUNC_ID_ZW_ASSIGN_SUC_RETURN_ROUTE 0x51 // Assign a return route to the SUC 295 #define FUNC_ID_ZW_ENABLE_SUC 0x52 // Make a controller a Static Update Controller 296 #define FUNC_ID_ZW_REQUEST_NETWORK_UPDATE 0x53 // Network update for a SUC(?) 297 #define FUNC_ID_ZW_SET_SUC_NODE_ID 0x54 // Identify a Static Update Controller node id 298 #define FUNC_ID_ZW_DELETE_SUC_RETURN_ROUTE 0x55 // Remove return routes to the SUC 299 #define FUNC_ID_ZW_GET_SUC_NODE_ID 0x56 // Try to retrieve a Static Update Controller node id (zero if no SUC present) 300 #define FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTIONS 0x5a // Allow options for request node neighbor update 301 #define FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION 0x5e // supports NWI 302 #define FUNC_ID_ZW_REQUEST_NODE_INFO 0x60 // Get info (supported command classes) for the specified node 303 #define FUNC_ID_ZW_REMOVE_FAILED_NODE_ID 0x61 // Mark a specified node id as failed 304 #define FUNC_ID_ZW_IS_FAILED_NODE_ID 0x62 // Check to see if a specified node has failed 305 #define FUNC_ID_ZW_REPLACE_FAILED_NODE 0x63 // Remove a failed node from the controller's list (?) 306 #define FUNC_ID_ZW_GET_ROUTING_INFO 0x80 // Get a specified node's neighbor information from the controller 307 #define FUNC_ID_SERIAL_API_SLAVE_NODE_INFO 0xA0 // Set application virtual slave node information 308 #define FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER 0xA1 // Slave command handler 309 #define FUNC_ID_ZW_SEND_SLAVE_NODE_INFO 0xA2 // Send a slave node information frame 310 #define FUNC_ID_ZW_SEND_SLAVE_DATA 0xA3 // Send data from slave 311 #define FUNC_ID_ZW_SET_SLAVE_LEARN_MODE 0xA4 // Enter slave learn mode 312 #define FUNC_ID_ZW_GET_VIRTUAL_NODES 0xA5 // Return all virtual nodes 313 #define FUNC_ID_ZW_IS_VIRTUAL_NODE 0xA6 // Virtual node test 314 #define FUNC_ID_ZW_SET_PROMISCUOUS_MODE 0xD0 // Set controller into promiscuous mode to listen to all frames 315 #define FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER 0xD1 317 #define FUNC_ID_PROPRIETARY_0 0xF0 318 #define FUNC_ID_PROPRIETARY_1 0xF1 319 #define FUNC_ID_PROPRIETARY_2 0xF2 320 #define FUNC_ID_PROPRIETARY_3 0xF3 321 #define FUNC_ID_PROPRIETARY_4 0xF4 322 #define FUNC_ID_PROPRIETARY_5 0xF5 323 #define FUNC_ID_PROPRIETARY_6 0xF6 324 #define FUNC_ID_PROPRIETARY_7 0xF7 325 #define FUNC_ID_PROPRIETARY_8 0xF8 326 #define FUNC_ID_PROPRIETARY_9 0xF9 327 #define FUNC_ID_PROPRIETARY_A 0xFA 328 #define FUNC_ID_PROPRIETARY_B 0xFB 329 #define FUNC_ID_PROPRIETARY_C 0xFC 330 #define FUNC_ID_PROPRIETARY_D 0xFD 331 #define FUNC_ID_PROPRIETARY_E 0xFE 333 #define ADD_NODE_ANY 0x01 334 #define ADD_NODE_CONTROLLER 0x02 335 #define ADD_NODE_SLAVE 0x03 336 #define ADD_NODE_EXISTING 0x04 337 #define ADD_NODE_STOP 0x05 338 #define ADD_NODE_STOP_FAILED 0x06 340 #define ADD_NODE_STATUS_LEARN_READY 0x01 341 #define ADD_NODE_STATUS_NODE_FOUND 0x02 342 #define ADD_NODE_STATUS_ADDING_SLAVE 0x03 343 #define ADD_NODE_STATUS_ADDING_CONTROLLER 0x04 344 #define ADD_NODE_STATUS_PROTOCOL_DONE 0x05 345 #define ADD_NODE_STATUS_DONE 0x06 346 #define ADD_NODE_STATUS_FAILED 0x07 348 #define REMOVE_NODE_ANY 0x01 349 #define REMOVE_NODE_CONTROLLER 0x02 350 #define REMOVE_NODE_SLAVE 0x03 351 #define REMOVE_NODE_STOP 0x05 353 #define REMOVE_NODE_STATUS_LEARN_READY 0x01 354 #define REMOVE_NODE_STATUS_NODE_FOUND 0x02 355 #define REMOVE_NODE_STATUS_REMOVING_SLAVE 0x03 356 #define REMOVE_NODE_STATUS_REMOVING_CONTROLLER 0x04 357 #define REMOVE_NODE_STATUS_DONE 0x06 358 #define REMOVE_NODE_STATUS_FAILED 0x07 360 #define CREATE_PRIMARY_START 0x02 361 #define CREATE_PRIMARY_STOP 0x05 362 #define CREATE_PRIMARY_STOP_FAILED 0x06 364 #define CONTROLLER_CHANGE_START 0x02 365 #define CONTROLLER_CHANGE_STOP 0x05 366 #define CONTROLLER_CHANGE_STOP_FAILED 0x06 368 #define LEARN_MODE_STARTED 0x01 369 #define LEARN_MODE_DONE 0x06 370 #define LEARN_MODE_FAILED 0x07 371 #define LEARN_MODE_DELETED 0x80 373 #define REQUEST_NEIGHBOR_UPDATE_STARTED 0x21 374 #define REQUEST_NEIGHBOR_UPDATE_DONE 0x22 375 #define REQUEST_NEIGHBOR_UPDATE_FAILED 0x23 377 #define FAILED_NODE_OK 0x00 378 #define FAILED_NODE_REMOVED 0x01 379 #define FAILED_NODE_NOT_REMOVED 0x02 381 #define FAILED_NODE_REPLACE_WAITING 0x03 382 #define FAILED_NODE_REPLACE_DONE 0x04 383 #define FAILED_NODE_REPLACE_FAILED 0x05 385 #define FAILED_NODE_REMOVE_STARTED 0x00 386 #define FAILED_NODE_NOT_PRIMARY_CONTROLLER 0x02 387 #define FAILED_NODE_NO_CALLBACK_FUNCTION 0x04 388 #define FAILED_NODE_NOT_FOUND 0x08 389 #define FAILED_NODE_REMOVE_PROCESS_BUSY 0x10 390 #define FAILED_NODE_REMOVE_FAIL 0x20 392 #define SUC_UPDATE_DONE 0x00 393 #define SUC_UPDATE_ABORT 0x01 394 #define SUC_UPDATE_WAIT 0x02 395 #define SUC_UPDATE_DISABLED 0x03 396 #define SUC_UPDATE_OVERFLOW 0x04 398 #define SUC_FUNC_BASIC_SUC 0x00 399 #define SUC_FUNC_NODEID_SERVER 0x01 401 #define UPDATE_STATE_NODE_INFO_RECEIVED 0x84 402 #define UPDATE_STATE_NODE_INFO_REQ_DONE 0x82 403 #define UPDATE_STATE_NODE_INFO_REQ_FAILED 0x81 404 #define UPDATE_STATE_ROUTING_PENDING 0x80 405 #define UPDATE_STATE_NEW_ID_ASSIGNED 0x40 406 #define UPDATE_STATE_DELETE_DONE 0x20 407 #define UPDATE_STATE_SUC_ID 0x10 409 #define APPLICATION_NODEINFO_LISTENING 0x01 410 #define APPLICATION_NODEINFO_OPTIONAL_FUNCTIONALITY 0x02 412 #define SLAVE_ASSIGN_COMPLETE 0x00 413 #define SLAVE_ASSIGN_NODEID_DONE 0x01 // Node ID has been assigned 414 #define SLAVE_ASSIGN_RANGE_INFO_UPDATE 0x02 // Node is doing neighbor discovery 416 #define SLAVE_LEARN_MODE_DISABLE 0x00 // disable add/remove virtual slave nodes 417 #define SLAVE_LEARN_MODE_ENABLE 0x01 // enable ability to include/exclude virtual slave nodes 418 #define SLAVE_LEARN_MODE_ADD 0x02 // add node directly but only if primary/inclusion controller 419 #define SLAVE_LEARN_MODE_REMOVE 0x03 // remove node directly but only if primary/inclusion controller 421 #define OPTION_HIGH_POWER 0x80 422 #define OPTION_NWI 0x40 // NWI Inclusion 424 #define BASIC_SET 0x01 425 #define BASIC_REPORT 0x03 427 #define COMMAND_CLASS_BASIC 0x20 428 #define COMMAND_CLASS_CONTROLLER_REPLICATION 0x21 429 #define COMMAND_CLASS_APPLICATION_STATUS 0x22 430 #define COMMAND_CLASS_HAIL 0x82 433 #define ZW_LIB_CONTROLLER_STATIC 0x01 434 #define ZW_LIB_CONTROLLER 0x02 435 #define ZW_LIB_SLAVE_ENHANCED 0x03 436 #define ZW_LIB_SLAVE 0x04 437 #define ZW_LIB_INSTALLER 0x05 438 #define ZW_LIB_SLAVE_ROUTING 0x06 439 #define ZW_LIB_CONTROLLER_BRIDGE 0x07 440 #define ZW_LIB_DUT 0x08 443 #define SERIAL_API_SETUP_CMD_TX_STATUS_REPORT 0x02 444 #define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_SET 0x04 445 #define SERIAL_API_SETUP_CMD_TX_POWERLEVEL_GET 0x08 446 #define SERIAL_API_SETUP_CMD_TX_GET_MAX_PAYLOAD_SIZE 0x10 Definition: Bitfield.cpp:30
float float32
Definition: Defs.h:104
unsigned short uint16
Definition: Defs.h:89
uint32_t _v
Definition: Defs.h:109
signed short int16
Definition: Defs.h:88
signed char int8
Definition: Defs.h:85
signed int int32
Definition: Defs.h:91
unsigned int uint32
Definition: Defs.h:92
TXSTATUS_ROUTING_SCHEME
Definition: Defs.h:449
struct ozwversion ozwversion
TXSTATUS_ROUTE_SPEED
Definition: Defs.h:462
double float64
Definition: Defs.h:105
unsigned char uint8
Definition: Defs.h:86