MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / HandleSerialAPIGetInitDataResponse

Method HandleSerialAPIGetInitDataResponse

cpp/src/Driver.cpp:2836–2926  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Process a response from the Z-Wave PC interface -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2834// Process a response from the Z-Wave PC interface
2835//-----------------------------------------------------------------------------
2836void Driver::HandleSerialAPIGetInitDataResponse
2837(
2838 uint8* _data
2839)
2840{
2841 int32 i;
2842
2843 if( !m_init )
2844 {
2845 // Mark the driver as ready (we have to do this first or
2846 // all the code handling notifications will go awry).
2847 Manager::Get()->SetDriverReady( this, true );
2848
2849 // Read the config file first, to get the last known state
2850 ReadCache();
2851 }
2852 else
2853 {
2854 // Notify the user that all node and value information has been deleted
2855 // We need to wait to do this here so we have new information to report.
2856 Notification* notification = new Notification( Notification::Type_DriverReset );
2857 notification->SetHomeAndNodeIds( m_homeId, 0 );
2858 QueueNotification( notification );
2859 }
2860
2861 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), "Received reply to FUNC_ID_SERIAL_API_GET_INIT_DATA:" );
2862 m_initVersion = _data[2];
2863 m_initCaps = _data[3];
2864
2865 if( _data[4] == NUM_NODE_BITFIELD_BYTES )
2866 {
2867 for( i=0; i<NUM_NODE_BITFIELD_BYTES; ++i)
2868 {
2869 for( int32 j=0; j<8; ++j )
2870 {
2871 uint8 nodeId = (i*8)+j+1;
2872 if( _data[i+5] & (0x01 << j) )
2873 {
2874 if( IsVirtualNode( nodeId ) )
2875 {
2876 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Node %.3d - Virtual (ignored)", nodeId );
2877 }
2878 else
2879 {
2880 LockGuard LG(m_nodeMutex);
2881 Node* node = GetNode( nodeId );
2882 if( node )
2883 {
2884 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Node %.3d - Known", nodeId );
2885 if( !m_init )
2886 {
2887 // The node was read in from the config, so we
2888 // only need to get its current state
2889 node->SetQueryStage( Node::QueryStage_CacheLoad );
2890 }
2891
2892 }
2893 else

Callers

nothing calls this directly

Calls 5

WriteFunction · 0.85
IsVirtualNodeFunction · 0.85
SetDriverReadyMethod · 0.80
SetQueryStageMethod · 0.80
GetFunction · 0.70

Tested by

no test coverage detected