52 class ControllerReplication;
85 ControllerInterface_Unknown = 0,
87 ControllerInterface_Hid
97 Driver(
string const& _controllerPath, ControllerInterface
const& _interface );
111 static void DriverThreadEntryPoint(
Event* _exitEvent,
void* _context );
130 void DriverThreadProc(
Event* _exitEvent );
144 bool Init(
uint32 _attempts );
150 void RemoveQueues(
uint8 const _nodeId );
156 bool m_awakeNodesQueried;
157 bool m_allNodesQueried;
158 bool m_notifytransactions;
165 void RequestConfig();
176 ControllerCaps_Secondary = 0x01,
177 ControllerCaps_OnOtherNetwork = 0x02,
178 ControllerCaps_SIS = 0x04,
179 ControllerCaps_RealPrimary = 0x08,
180 ControllerCaps_SUC = 0x10
186 InitCaps_Slave = 0x01,
187 InitCaps_TimerSupport = 0x02,
188 InitCaps_Secondary = 0x04,
192 bool IsPrimaryController()
const{
return ((m_initCaps & InitCaps_Secondary) == 0); }
193 bool IsStaticUpdateController()
const{
return ((m_initCaps & InitCaps_SUC) != 0); }
194 bool IsBridgeController()
const{
return (m_libraryType == 7); }
195 bool IsInclusionController()
const{
return ((m_controllerCaps & ControllerCaps_SIS) != 0); }
198 uint32 GetHomeId()
const{
return m_homeId; }
199 uint8 GetControllerNodeId()
const{
return m_Controller_nodeId; }
200 uint8 GetSUCNodeId()
const{
return m_SUCNodeId; }
201 uint16 GetManufacturerId()
const{
return m_manufacturerId; }
202 uint16 GetProductType()
const{
return m_productType; }
203 uint16 GetProductId()
const{
return m_productId; }
204 string GetControllerPath()
const{
return m_controllerPath; }
205 ControllerInterface GetControllerInterfaceType()
const{
return m_controllerInterfaceType; }
206 string GetLibraryVersion()
const{
return m_libraryVersion; }
207 string GetLibraryTypeName()
const{
return m_libraryTypeName; }
208 int32 GetSendQueueCount()
const 211 for(
int32 i=0; i<MsgQueue_Count; ++i )
213 count += (
int32) (m_msgQueue[i].size());
227 Node* GetNodeUnsafe(
uint8 _nodeId );
237 Node* GetNode(
uint8 _nodeId );
247 ControllerInterface m_controllerInterfaceType;
248 string m_controllerPath;
249 Controller* m_controller;
252 string m_libraryVersion;
253 string m_libraryTypeName;
256 uint8 m_serialAPIVersion[2];
264 uint8 m_controllerCaps;
265 uint8 m_Controller_nodeId;
269 ControllerReplication* m_controllerReplication;
271 uint8 m_transmitOptions;
278 void ProcessMsg(
uint8* _data );
280 void HandleGetVersionResponse(
uint8* _data );
281 void HandleGetRandomResponse(
uint8* _data );
282 void HandleGetControllerCapabilitiesResponse(
uint8* _data );
283 void HandleGetSerialAPICapabilitiesResponse(
uint8* _data );
284 void HandleSerialAPISoftResetResponse(
uint8* _data );
285 void HandleEnableSUCResponse(
uint8* _data );
286 void HandleSetSUCNodeIdResponse(
uint8* _data );
287 void HandleGetSUCNodeIdResponse(
uint8* _data );
288 void HandleMemoryGetIdResponse(
uint8* _data );
301 void HandleSerialAPIGetInitDataResponse(
uint8* _data );
302 void HandleGetNodeProtocolInfoResponse(
uint8* _data );
303 bool HandleRemoveFailedNodeResponse(
uint8* _data );
304 void HandleIsFailedNodeResponse(
uint8* _data );
305 bool HandleReplaceFailedNodeResponse(
uint8* _data );
306 bool HandleAssignReturnRouteResponse(
uint8* _data );
307 bool HandleDeleteReturnRouteResponse(
uint8* _data );
308 void HandleSendNodeInformationRequest(
uint8* _data );
309 void HandleSendDataResponse(
uint8* _data,
bool _replication );
310 bool HandleNetworkUpdateResponse(
uint8* _data );
311 void HandleGetRoutingInfoResponse(
uint8* _data );
313 void HandleSendDataRequest(
uint8* _data,
bool _replication );
314 void HandleAddNodeToNetworkRequest(
uint8* _data );
315 void HandleCreateNewPrimaryRequest(
uint8* _data );
316 void HandleControllerChangeRequest(
uint8* _data );
317 void HandleSetLearnModeRequest(
uint8* _data );
318 void HandleRemoveFailedNodeRequest(
uint8* _data );
319 void HandleReplaceFailedNodeRequest(
uint8* _data );
320 void HandleRemoveNodeFromNetworkRequest(
uint8* _data );
321 void HandleApplicationCommandHandlerRequest(
uint8* _data,
bool encrypted );
322 void HandlePromiscuousApplicationCommandHandlerRequest(
uint8* _data );
323 void HandleAssignReturnRouteRequest(
uint8* _data );
324 void HandleDeleteReturnRouteRequest(
uint8* _data );
325 void HandleNodeNeighborUpdateRequest(
uint8* _data );
326 void HandleNetworkUpdateRequest(
uint8* _data );
327 bool HandleApplicationUpdateRequest(
uint8* _data );
328 bool HandleRfPowerLevelSetResponse(
uint8* _data );
329 bool HandleSerialApiSetTimeoutsResponse(
uint8* _data );
330 bool HandleMemoryGetByteResponse(
uint8* _data );
331 bool HandleReadMemoryResponse(
uint8* _data );
332 void HandleGetVirtualNodesResponse(
uint8* _data );
333 bool HandleSetSlaveLearnModeResponse(
uint8* _data );
334 void HandleSetSlaveLearnModeRequest(
uint8* _data );
335 bool HandleSendSlaveNodeInfoResponse(
uint8* _data );
336 void HandleSendSlaveNodeInfoRequest(
uint8* _data );
337 void HandleApplicationSlaveCommandRequest(
uint8* _data );
338 void HandleSerialAPIResetRequest(
uint8* _data );
340 void CommonAddNodeStatusRequestHandler(
uint8 _funcId,
uint8* _data );
342 bool m_waitingForAck;
343 uint8 m_expectedCallbackId;
344 uint8 m_expectedReply;
345 uint8 m_expectedCommandClassId;
346 uint8 m_expectedNodeId;
352 int32 GetPollInterval(){
return m_pollInterval ; }
353 void SetPollInterval(
int32 _milliseconds,
bool _bIntervalBetweenPolls ){ m_pollInterval = _milliseconds; m_bIntervalBetweenPolls = _bIntervalBetweenPolls; }
354 bool EnablePoll(
const ValueID &_valueId,
uint8 _intensity = 1 );
355 bool DisablePoll(
const ValueID &_valueId );
356 bool isPolled(
const ValueID &_valueId );
357 void SetPollIntensity(
const ValueID &_valueId,
uint8 _intensity );
358 static void PollThreadEntryPoint( Event* _exitEvent,
void* _context );
359 void PollThreadProc( Event* _exitEvent );
361 Thread* m_pollThread;
368 list<PollEntry> m_pollList;
371 int32 m_pollInterval;
372 bool m_bIntervalBetweenPolls;
392 void InitNode(
uint8 const _nodeId,
bool newNode =
false,
bool secure =
false,
uint8 const *_protocolInfo =
NULL,
uint8 const _length = 0);
396 bool IsNodeListeningDevice(
uint8 const _nodeId );
397 bool IsNodeFrequentListeningDevice(
uint8 const _nodeId );
398 bool IsNodeBeamingDevice(
uint8 const _nodeId );
399 bool IsNodeRoutingDevice(
uint8 const _nodeId );
400 bool IsNodeSecurityDevice(
uint8 const _nodeId );
407 string GetNodeType(
uint8 const _nodeId );
410 string GetNodeManufacturerName(
uint8 const _nodeId );
411 string GetNodeProductName(
uint8 const _nodeId );
412 string GetNodeName(
uint8 const _nodeId );
413 string GetNodeLocation(
uint8 const _nodeId );
415 string GetNodeDeviceTypeString(
uint8 const _nodeId );
417 string GetNodeRoleString(
uint8 const _nodeId );
419 string GetNodePlusTypeString (
uint8 const _nodeId );
420 bool IsNodeZWavePlus(
uint8 const _nodeId );
423 uint16 GetNodeManufacturerId(
uint8 const _nodeId );
426 void SetNodeManufacturerName(
uint8 const _nodeId,
string const& _manufacturerName );
427 void SetNodeProductName(
uint8 const _nodeId,
string const& _productName );
428 void SetNodeName(
uint8 const _nodeId,
string const& _nodeName );
429 void SetNodeLocation(
uint8 const _nodeId,
string const& _location );
430 void SetNodeLevel(
uint8 const _nodeId,
uint8 const _level );
431 void SetNodeOn(
uint8 const _nodeId );
432 void SetNodeOff(
uint8 const _nodeId );
436 bool IsAPICallSupported(
uint8 const _apinum )
const{
return (( m_apiMask[( _apinum - 1 ) >> 3] & ( 1 << (( _apinum - 1 ) & 0x07 ))) != 0 ); }
437 void SetAPICall(
uint8 const _apinum,
bool _toSet )
441 m_apiMask[( _apinum - 1 ) >> 3] |= ( 1 << (( _apinum - 1 ) & 0x07 ));
445 m_apiMask[( _apinum - 1 ) >> 3] &= ~( 1 << (( _apinum - 1 ) & 0x07 ));
461 ControllerCommand_None = 0,
477 ControllerCommand_DeleteButton
487 ControllerState_Normal = 0,
497 ControllerState_NodeFailed
506 ControllerError_None = 0,
518 ControllerError_Overflow
525 void ResetController(
Event* _evt );
527 void RequestNodeNeighbors(
uint8 const _nodeId,
uint32 const _requestFlags );
529 bool BeginControllerCommand(
ControllerCommand _command, pfnControllerCallback_t _callback,
void* _context,
bool _highPower,
uint8 _nodeId,
uint8 _arg );
530 bool CancelControllerCommand();
531 void AddNodeStop(
uint8 const _funcId );
533 struct ControllerCommandItem
536 bool m_controllerStateChanged;
537 bool m_controllerCommandDone;
539 pfnControllerCallback_t m_controllerCallback;
541 void* m_controllerCallbackContext;
543 bool m_controllerAdded;
544 uint8 m_controllerCommandNode;
545 uint8 m_controllerCommandArg;
546 uint8 m_controllerDeviceProtocolInfo[254];
547 uint8 m_controllerDeviceProtocolInfoLength;
550 ControllerCommandItem* m_currentControllerCommand;
552 void DoControllerCommand();
553 void UpdateControllerState( ControllerState
const _state, ControllerError
const _error = ControllerError_None );
557 void UpdateNodeRoutes(
uint8 const_nodeId,
bool _doUpdate =
false );
559 Event* m_controllerResetEvent;
567 MsgQueue_Command = 0,
578 void SendMsg(
Msg* _msg, MsgQueue
const _queue );
603 bool WriteNextMsg( MsgQueue
const _queue );
604 bool WriteMsg(
string const &str);
605 void RemoveCurrentMsg();
606 bool MoveMessagesToWakeUpQueue(
uint8 const _targetNodeId,
bool const _move );
607 bool HandleErrorResponse(
uint8 const _error,
uint8 const _nodeId,
char const* _funcStr,
bool _sleepCheck =
false );
608 bool IsExpectedReply(
uint8 const _nodeId );
611 void CheckCompletedNodeQueries();
649 MsgQueueCmd_SendMsg = 0,
650 MsgQueueCmd_QueryStageComplete,
651 MsgQueueCmd_Controller
660 m_queryStage(Node::QueryStage_None),
665 bool operator == ( MsgQueueItem
const& _other )
const 667 if( _other.m_command == m_command )
669 if( m_command == MsgQueueCmd_SendMsg )
671 return( (*_other.m_msg) == (*m_msg) );
673 else if( m_command == MsgQueueCmd_QueryStageComplete )
675 return( (_other.m_nodeId == m_nodeId) && (_other.m_queryStage == m_queryStage) );
677 else if( m_command == MsgQueueCmd_Controller )
679 return( (_other.m_cci->m_controllerCommand == m_cci->m_controllerCommand) && (_other.m_cci->m_controllerCallback == m_cci->m_controllerCallback) );
686 MsgQueueCmd m_command;
691 ControllerCommandItem* m_cci;
695 list<MsgQueueItem> m_msgQueue[MsgQueue_Count];
697 Event* m_queueEvent[MsgQueue_Count];
700 MsgQueue m_currentMsgQueueSource;
701 TimeStamp m_resendTimeStamp;
707 void TestNetwork(
uint8 const _nodeId,
uint32 const _count );
719 void RequestVirtualNeighbors( MsgQueue
const _queue );
720 bool IsVirtualNode(
uint8 const _nodeId )
const{
return (( m_virtualNeighbors[( _nodeId - 1 ) >> 3] & 1 << (( _nodeId - 1 ) & 0x07 )) != 0 ); }
721 void SendVirtualNodeInfo(
uint8 const _fromNodeId,
uint8 const _ToNodeId );
722 void SendSlaveLearnModeOff();
724 void ReadButtons(
uint8 const _nodeId );
726 bool m_virtualNeighborsReceived;
742 bool SetConfigParam(
uint8 const _nodeId,
uint8 const _param,
int32 _value,
uint8 const _size );
743 void RequestConfigParam(
uint8 const _nodeId,
uint8 const _param );
753 uint8 GetMaxAssociations(
uint8 const _nodeId,
uint8 const _groupIdx );
754 string GetGroupLabel(
uint8 const _nodeId,
uint8 const _groupIdx );
755 void AddAssociation(
uint8 const _nodeId,
uint8 const _groupIdx,
uint8 const _targetNodeId,
uint8 const _instance = 0x00 );
756 void RemoveAssociation(
uint8 const _nodeId,
uint8 const _groupIdx,
uint8 const _targetNodeId,
uint8 const _instance = 0x00 );
762 void QueueNotification( Notification* _notification );
763 void NotifyWatchers();
766 list<Notification*> m_notifications;
768 Event* m_notificationsEvent;
799 void LogDriverStatistics();
802 void GetDriverStatistics(
DriverData* _data );
824 uint32 m_broadcastReadCnt;
825 uint32 m_broadcastWriteCnt;
836 bool isNetworkKeySet();
839 bool initNetworkKeys(
bool newnode);
840 uint8 *GetNetworkKey();
841 bool SendEncryptedMessage();
842 bool SendNonceRequest(
string logmsg);
843 void SendNonceKey(
uint8 nodeId,
uint8 *nonce);
846 uint8 m_nonceReportSent;
847 uint8 m_nonceReportSentAttempt;
848 bool m_inclusionkeySet;
Implements COMMAND_CLASS_NO_OPERATION (0x00), a Z-Wave device command class.
Definition: NoOperation.h:37
uint32 m_CANCnt
Definition: Driver.h:782
Implements COMMAND_CLASS_ASSOCIATION (0x85), a Z-Wave device command class.
Definition: Association.h:38
Message object to be passed to and from devices on the Z-Wave network.
Definition: Msg.h:44
Definition: Bitfield.h:34
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:43
MsgQueue
Definition: Driver.h:565
Definition: Security.h:63
uint8 GetTargetNodeId() const
Identifies the Node ID of the "target" node (if any) for this function.
Definition: Msg.h:66
#define OPENZWAVE_EXPORT
Definition: Defs.h:52
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:38
unsigned short uint16
Definition: Defs.h:77
#define OPENZWAVE_EXPORT_WARNINGS_ON
Definition: Defs.h:54
uint32 m_routedbusy
Definition: Driver.h:794
Platform-independent definition of event objects.
Definition: Event.h:39
uint32 m_nondelivery
Definition: Driver.h:793
uint8 GetTransmitOptions() const
Definition: Driver.h:583
uint32 m_readAborts
Definition: Driver.h:778
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:43
The main public interface to OpenZWave.
Definition: Manager.h:109
uint32 m_ACKWaiting
Definition: Driver.h:777
struct OpenZWave::InstanceAssociation InstanceAssociation
Implements a platform-independent thread management class.
Definition: Thread.h:42
QueryStage
Definition: Node.h:134
uint32 m_badChecksum
Definition: Driver.h:779
uint32 m_writeCnt
Definition: Driver.h:781
#define OPENZWAVE_EXPORT_WARNINGS_OFF
Definition: Defs.h:53
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:64
#define NULL
Definition: Defs.h:70
ControllerCommand
Definition: Driver.h:459
uint32 m_readCnt
Definition: Driver.h:780
Base class for all Z-Wave command classes.
Definition: CommandClass.h:46
ControllerError
Definition: Driver.h:504
uint32 m_OOFCnt
Definition: Driver.h:785
ControllerState
Definition: Driver.h:485
uint32 m_notidle
Definition: Driver.h:792
uint32 m_SOFCnt
Definition: Driver.h:776
Implements COMMAND_CLASS_MULTI_CHANNEL_ASSOCIATION (0x8E), a Z-Wave device command class...
Definition: MultiChannelAssociation.h:39
ControllerInterface
Definition: Driver.h:83
uint32 m_broadcastReadCnt
Definition: Driver.h:795
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:58
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:39
uint32 m_badroutes
Definition: Driver.h:789
signed int int32
Definition: Defs.h:79
unsigned int uint32
Definition: Defs.h:80
uint8 GetNodeNumber(Msg const *_msg) const
Definition: Driver.h:378
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:49
uint32 m_broadcastWriteCnt
Definition: Driver.h:796
Provides a unique ID for a value reported by a Z-Wave device.
Definition: ValueID.h:53
uint32 m_callbacks
Definition: Driver.h:788
uint32 m_netbusy
Definition: Driver.h:791
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition: Mutex.h:39
uint32 m_retries
Definition: Driver.h:787
uint32 m_noack
Definition: Driver.h:790
Implements a platform-independent TimeStamp.
Definition: TimeStamp.h:39
Base class for values associated with a node.
Definition: Value.h:47
uint32 m_dropped
Definition: Driver.h:786
uint32 m_NAKCnt
Definition: Driver.h:783
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:37
Implements COMMAND_CLASS_CONTROLLER_REPLICATION (0x21), a Z-Wave device command class.
Definition: ControllerReplication.h:37
uint32 m_ACKCnt
Definition: Driver.h:784
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:39
#define NUM_NODE_BITFIELD_BYTES
Definition: Defs.h:224
unsigned char uint8
Definition: Defs.h:74