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

Method HandleGetSerialAPICapabilitiesResponse

cpp/src/Driver.cpp:2632–2695  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2630// Process a response from the Z-Wave PC interface
2631//-----------------------------------------------------------------------------
2632void Driver::HandleGetSerialAPICapabilitiesResponse
2633(
2634 uint8* _data
2635)
2636{
2637 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Received reply to FUNC_ID_SERIAL_API_GET_CAPABILITIES" );
2638 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Serial API Version: %d.%d", _data[2], _data[3] );
2639 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Manufacturer ID: 0x%.2x%.2x", _data[4], _data[5] );
2640 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Product Type: 0x%.2x%.2x", _data[6], _data[7] );
2641 Log::Write( LogLevel_Info, GetNodeNumber( m_currentMsg ), " Product ID: 0x%.2x%.2x", _data[8], _data[9] );
2642
2643 // _data[10] to _data[41] are a 256-bit bitmask with one bit set for
2644 // each FUNC_ID_ method supported by the controller.
2645 // Bit 0 is FUNC_ID_ 1. So FUNC_ID_SERIAL_API_GET_CAPABILITIES (0x07) will be bit 6 of the first byte.
2646 m_serialAPIVersion[0] = _data[2];
2647 m_serialAPIVersion[1] = _data[3];
2648 m_manufacturerId = ( ( (uint16)_data[4] )<<8) | (uint16)_data[5];
2649 m_productType = ( ( (uint16)_data[6] )<<8 ) | (uint16)_data[7];
2650 m_productId = ( ( (uint16)_data[8] )<<8 ) | (uint16)_data[9];
2651 memcpy( m_apiMask, &_data[10], sizeof( m_apiMask ) );
2652
2653 if( IsBridgeController() )
2654 {
2655 SendMsg( new Msg( "FUNC_ID_ZW_GET_VIRTUAL_NODES", 0xff, REQUEST, FUNC_ID_ZW_GET_VIRTUAL_NODES, false ), MsgQueue_Command);
2656 }
2657 if( IsAPICallSupported( FUNC_ID_ZW_GET_RANDOM ) )
2658
2659 {
2660 Msg *msg = new Msg( "FUNC_ID_ZW_GET_RANDOM", 0xff, REQUEST, FUNC_ID_ZW_GET_RANDOM, false );
2661 msg->Append( 32 ); // 32 bytes
2662 SendMsg( msg, MsgQueue_Command );
2663 }
2664
2665 if( IsAPICallSupported( FUNC_ID_SERIAL_API_SETUP ) )
2666
2667 {
2668 Msg *msg = new Msg( "FUNC_ID_SERIAL_API_SETUP", 0xff, REQUEST, FUNC_ID_SERIAL_API_SETUP, false );
2669 msg->Append( SERIAL_API_SETUP_CMD_TX_STATUS_REPORT );
2670 msg->Append( 1 );
2671 SendMsg( msg, MsgQueue_Command );
2672 }
2673
2674
2675 SendMsg( new Msg( "FUNC_ID_SERIAL_API_GET_INIT_DATA", 0xff, REQUEST, FUNC_ID_SERIAL_API_GET_INIT_DATA, false ), MsgQueue_Command);
2676 if( !IsBridgeController() )
2677 {
2678 Msg* msg = new Msg( "FUNC_ID_SERIAL_API_SET_TIMEOUTS", 0xff, REQUEST, FUNC_ID_SERIAL_API_SET_TIMEOUTS, false );
2679 msg->Append( ACK_TIMEOUT / 10 );
2680 msg->Append( BYTE_TIMEOUT / 10 );
2681 SendMsg( msg, MsgQueue_Command );
2682 }
2683 Msg* msg = new Msg( "FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION", 0xff, REQUEST, FUNC_ID_SERIAL_API_APPL_NODE_INFORMATION, false, false );
2684 msg->Append( APPLICATION_NODEINFO_LISTENING );
2685 msg->Append( 0x02 ); // Generic Static Controller
2686 msg->Append( 0x01 ); // Specific Static PC Controller
2687
2688 /* get a list of Advertised Command Classes */
2689 list<uint8> advertisedCommandClasses = CommandClasses::GetAdvertisedCommandClasses();

Callers

nothing calls this directly

Calls 7

WriteFunction · 0.85
IsBridgeControllerFunction · 0.85
IsAPICallSupportedFunction · 0.85
AppendMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected