Skip to content

Commit

Permalink
Start work on 700 Series Bridge Firmware - #2126
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishwaldo committed Feb 20, 2020
1 parent 2e18ba8 commit 3cf0dc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions cpp/src/Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ namespace OpenZWave
#define FUNC_ID_ZW_SET_SLAVE_LEARN_MODE 0xA4 // Enter slave learn mode
#define FUNC_ID_ZW_GET_VIRTUAL_NODES 0xA5 // Return all virtual nodes
#define FUNC_ID_ZW_IS_VIRTUAL_NODE 0xA6 // Virtual node test
#define FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE 0xA8 // Bridge Version of FUNC_ID_APPLICATION_COMMAND_HANDLER
#define FUNC_ID_ZW_SET_PROMISCUOUS_MODE 0xD0 // Set controller into promiscuous mode to listen to all frames
#define FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER 0xD1

Expand Down
17 changes: 10 additions & 7 deletions cpp/src/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ bool Driver::WriteMsg(string const &msg)
{
node->m_sentCnt++;
node->m_sentTS.SetTime();
if (m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER)
if ( (m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER) || (m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE) )
{
Internal::CC::CommandClass *cc = node->GetCommandClass(m_expectedCommandClassId);
if (cc != NULL)
Expand Down Expand Up @@ -1780,7 +1780,7 @@ void Driver::ProcessMsg(uint8* _data, uint8 _length)
bool wasencrypted = false;
//uint8 nodeId = GetNodeNumber( m_currentMsg );

if ((REQUEST == _data[0]) && FUNC_ID_APPLICATION_COMMAND_HANDLER == _data[1] && (Internal::CC::Security::StaticGetCommandClassId() == _data[5]))
if ((REQUEST == _data[0]) && ( ( FUNC_ID_APPLICATION_COMMAND_HANDLER == _data[1] ) || ( FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE == _data[1] ) ) && (Internal::CC::Security::StaticGetCommandClassId() == _data[5]))
{
/* if this message is a NONCE Report - Then just Trigger the Encrypted Send */
if (Internal::CC::SecurityCmd_NonceReport == _data[6])
Expand Down Expand Up @@ -2177,6 +2177,7 @@ void Driver::ProcessMsg(uint8* _data, uint8 _length)
switch (_data[1])
{
case FUNC_ID_APPLICATION_COMMAND_HANDLER:
case FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE:
{
Log::Write(LogLevel_Detail, "");
HandleApplicationCommandHandlerRequest(_data, wasencrypted);
Expand Down Expand Up @@ -2362,7 +2363,7 @@ void Driver::ProcessMsg(uint8* _data, uint8 _length)
{
if (m_expectedReply == _data[1])
{
if (m_expectedCommandClassId && (m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER))
if (m_expectedCommandClassId && ( ( m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER) || ( m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE) ) )
{
if (m_expectedCallbackId == 0 && m_expectedCommandClassId == _data[5] && m_expectedNodeId == _data[3])
{
Expand Down Expand Up @@ -2418,10 +2419,10 @@ void Driver::HandleGetVersionResponse(uint8* _data)
}
Log::Write(LogLevel_Info, GetNodeNumber(m_currentMsg), "Received reply to FUNC_ID_ZW_GET_VERSION:");
Log::Write(LogLevel_Info, GetNodeNumber(m_currentMsg), " %s library, version %s", m_libraryTypeName.c_str(), m_libraryVersion.c_str());
if (!((m_libraryType == ZW_LIB_CONTROLLER_STATIC) || (m_libraryType == ZW_LIB_CONTROLLER)))
if (!((m_libraryType == ZW_LIB_CONTROLLER_STATIC) || (m_libraryType == ZW_LIB_CONTROLLER) || (m_libraryType == ZW_LIB_CONTROLLER_BRIDGE) ))
{
Log::Write(LogLevel_Fatal, GetNodeNumber(m_currentMsg), "Z-Wave Interface is not a Supported Library Type: %s", m_libraryTypeName.c_str());
Log::Write(LogLevel_Fatal, GetNodeNumber(m_currentMsg), "Z-Wave Interface should be a Static Controller Library Type");
Log::Write(LogLevel_Fatal, GetNodeNumber(m_currentMsg), "Z-Wave Interface should be a Static or Bridge Controller Library Type");

{
Notification* notification = new Notification(Notification::Type_UserAlerts);
Expand Down Expand Up @@ -2550,7 +2551,6 @@ void Driver::HandleGetSerialAPICapabilitiesResponse(uint8* _data)
}

SendMsg(new Internal::Msg("FUNC_ID_SERIAL_API_GET_INIT_DATA", 0xff, REQUEST, FUNC_ID_SERIAL_API_GET_INIT_DATA, false), MsgQueue_Command);
if (!IsBridgeController())
{
Internal::Msg* msg = new Internal::Msg("FUNC_ID_SERIAL_API_SET_TIMEOUTS", 0xff, REQUEST, FUNC_ID_SERIAL_API_SET_TIMEOUTS, false);
msg->Append( ACK_TIMEOUT / 10);
Expand Down Expand Up @@ -3580,7 +3580,7 @@ void Driver::HandleApplicationCommandHandlerRequest(uint8* _data, bool encrypted
memcpy(node->m_lastReceivedMessage, _data, sizeof(node->m_lastReceivedMessage));
}
node->m_receivedTS.SetTime();
if (m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER && m_expectedNodeId == nodeId)
if ( ( ( m_expectedReply == FUNC_ID_APPLICATION_COMMAND_HANDLER ) || ( m_expectedReply = FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE) ) && ( m_expectedNodeId == nodeId ) )
{
// Need to confirm this is the correct response to the last sent request.
// At least ignore any received messages prior to the send data request.
Expand Down Expand Up @@ -6426,6 +6426,9 @@ uint8 Driver::NodeFromMessage(uint8 const* buffer)
case FUNC_ID_APPLICATION_COMMAND_HANDLER:
nodeId = buffer[5];
break;
case FUNC_ID_APPLICATION_COMMAND_HANDLER_BRIDGE:
nodeId = buffer[6];
break;
case FUNC_ID_ZW_APPLICATION_UPDATE:
nodeId = buffer[5];
break;
Expand Down

0 comments on commit 3cf0dc6

Please sign in to comment.