More devices from tjko <oh6lxv@gmail.com>

Add device configuration option not to send a Node Protocol Request. See
act/lfm20.xml for an example of configuration syntax. Requires adding a new
query phase to obtain manufacturer information prior to sending Node
Protocol Request.
This commit is contained in:
glsatz 2011-10-07 04:35:13 +00:00
parent 1ee80acf04
commit daf4dbceae
7 changed files with 1123 additions and 17 deletions

5
config/act/lfm20.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Protocol nodeinfosupported="false" />
<Product>
</Product>

View file

@ -18,7 +18,7 @@
<Product type="5250" id="3030" name="ZRP100 Plugin Appliance Module" />
<Product type="5250" id="3130" name="ZRP110 Exterior Appliance Module" config="act/zrp110.xml" />
<Product type="5257" id="3330" name="ZRW230 Wall Appliance Module" />
<Product type="5246" id="3133" name="LFM-20 Relay Fixture Module" />
<Product type="5246" id="3133" name="LFM-20 Relay Fixture Module" config="act/lfm20.xml" />
<Product type="524d" id="3330" name="ZRM230 Wall Appliance Module" />
<Product type="5457" id="3330" name="ZTW230 Wall Transmitter Module" />
<Product type="544d" id="3330" name="ZTM230 Wall Transmitter Module" />
@ -198,8 +198,10 @@
<Product type="0401" id="0206" name="RZI10-1LX Multilevel Scene Switch" config="leviton/rzi10.xml" />
<Product type="0401" id="0209" name="VRI06-1LX Multilevel Scene Switch" config="leviton/vri06.xml" />
<Product type="0702" id="0261" name="VRCZ4-M0Z 4-Button Zone Controller" />
<Product type="0b02" id="030b" name="VRC0P-1LW Plug-in Serial Interface Module" />
<Product type="0c01" id="0206" name="VRCPG-SG RF Handheld Remote Controller" />
<Product type="1001" id="0209" name="VRF01-1LZ Multilevel Scene Switch - 1.5A Fan" config="leviton/vrf01.xml" />
<Product type="1102" id="0243" name="VRCS2-MRZ 2-Button Scene Controller with Switches" />
</Manufacturer>
<Manufacturer id="007f" name="Logitech">
</Manufacturer>
@ -284,7 +286,7 @@
</Manufacturer>
<Manufacturer id="008b" name="Trane">
<Product type="5452" id="5431" name="Model TZEMT400AB32MAA" config="trane/TZEMT400AB32MAA.xml" />
<Product type="5452" id="5433" name="Model TZEMT400BB32MAA" config="trane/TZEMT400AB32MAA.xml" />
<Product type="5452" id="5433" name="Model TZEMT400BB32MAA" config="trane/TZEMT400BB32MAA.xml" />
</Manufacturer>
<Manufacturer id="006b" name="Tricklestar">
</Manufacturer>

File diff suppressed because it is too large Load diff

View file

@ -922,7 +922,7 @@ bool Driver::MoveMessagesToWakeUpQueue
if( Node* node = GetNodeUnsafe(_targetNodeId) )
{
// Exclude controllers from battery check
if( !node->IsListeningDevice() && node->GetBasic() != 0x01 && node->GetBasic() != 0x02 && node->GetGeneric() != 0x01 && node->GetGeneric() != 0x02 )
if( !node->IsListeningDevice() && !node->IsController() )
{
if( WakeUp* wakeUp = static_cast<WakeUp*>( node->GetCommandClass( WakeUp::StaticGetCommandClassId() ) ) )
{

View file

@ -78,8 +78,9 @@ static char const* c_queryStageNames[] =
"None",
"ProtocolInfo",
"WakeUp",
"ManufacturerSpecific1",
"NodeInfo",
"ManufacturerSpecific",
"ManufacturerSpecific2",
"Versions",
"Instances",
"Static",
@ -107,6 +108,8 @@ Node::Node
m_queryStageCompleted( false ),
m_protocolInfoReceived( false ),
m_nodeInfoReceived( false ),
m_manufacturerSpecificClassReceived( false ),
m_nodeInfoSupported( true ),
m_listening( true ), // assume we start out listening
m_homeId( _homeId ),
m_nodeId( _nodeId ),
@ -216,7 +219,25 @@ void Node::AdvanceQueries
}
else
{
// this is not a sleeping device, so move to the NodeInfo stage
// this is not a sleeping device, so move to the ManufacturerSpecific1 stage
m_queryStage = QueryStage_ManufacturerSpecific1;
m_queryRetries = 0;
}
break;
}
case QueryStage_ManufacturerSpecific1:
{
// Obtain manufacturer, product type and product ID code from the node device
// Manufacturer Specific data is requested before the other command class data so
// that we can modify the supported command classes list through the product XML files.
Log::Write( "Node %d: QueryStage_ManufacturerSpecific1", m_nodeId );
ManufacturerSpecific* cc = static_cast<ManufacturerSpecific*>( GetCommandClass( ManufacturerSpecific::StaticGetCommandClassId() ) );
if( cc )
{
m_queryPending = cc->RequestState( CommandClass::RequestFlag_Static, 1 );
}
if( !m_queryPending )
{
m_queryStage = QueryStage_NodeInfo;
m_queryRetries = 0;
}
@ -224,7 +245,7 @@ void Node::AdvanceQueries
}
case QueryStage_NodeInfo:
{
if( !NodeInfoReceived() )
if( !NodeInfoReceived() && !IsController() && m_nodeInfoSupported )
{
// obtain from the node a list of command classes that it 1) supports and 2) controls (separated by a mark in the buffer)
Log::Write( "Node %d: QueryStage_NodeInfo", m_nodeId );
@ -236,23 +257,31 @@ void Node::AdvanceQueries
else
{
// This stage has been done already, so move to the Manufacturer Specific stage
m_queryStage = QueryStage_ManufacturerSpecific;
m_queryStage = QueryStage_ManufacturerSpecific2;
m_queryRetries = 0;
}
break;
}
case QueryStage_ManufacturerSpecific:
case QueryStage_ManufacturerSpecific2:
{
// Obtain manufacturer, product type and product ID code from the node device
// Manufacturer Specific data is requested before the other command class data so
// that we can modify the supported command classes list through the product XML files.
Log::Write( "Node %d: QueryStage_ManufacturerSpecific", m_nodeId );
ManufacturerSpecific* cc = static_cast<ManufacturerSpecific*>( GetCommandClass( ManufacturerSpecific::StaticGetCommandClassId() ) );
if( cc )
if( !m_manufacturerSpecificClassReceived )
{
m_queryPending = cc->RequestState( CommandClass::RequestFlag_Static, 1 );
// Obtain manufacturer, product type and product ID code from the node device
// Manufacturer Specific data is requested before the other command class data so
// that we can modify the supported command classes list through the product XML files.
Log::Write( "Node %d: QueryStage_ManufacturerSpecific2", m_nodeId );
ManufacturerSpecific* cc = static_cast<ManufacturerSpecific*>( GetCommandClass( ManufacturerSpecific::StaticGetCommandClassId() ) );
if( cc )
{
m_queryPending = cc->RequestState( CommandClass::RequestFlag_Static, 1 );
}
if( !m_queryPending )
{
m_queryStage = QueryStage_Versions;
m_queryRetries = 0;
}
}
if( !m_queryPending )
else
{
m_queryStage = QueryStage_Versions;
m_queryRetries = 0;
@ -674,6 +703,13 @@ void Node::ReadXML
m_security = (uint8)strtol( str, &p, 0 );
}
m_nodeInfoSupported = true;
str = _node->Attribute( "nodeinfosupported" );
if( str )
{
m_nodeInfoSupported = !strcmp( str, "true" );
}
// Read the manufacturer info and create the command classes
TiXmlElement const* child = _node->FirstChildElement();
while( child )
@ -733,6 +769,23 @@ void Node::ReadXML
}
}
//-----------------------------------------------------------------------------
// <Node::ReadDeviceProtocolXML>
// Read the device's protocol configuration from XML
//-----------------------------------------------------------------------------
void Node::ReadDeviceProtocolXML
(
TiXmlElement const* _ccsElement
)
{
char const* str = _ccsElement->Attribute( "nodeinfosupported" );
if( str )
{
m_nodeInfoSupported = !strcmp( str, "true" );
}
}
//-----------------------------------------------------------------------------
// <Node::ReadCommandClassesXML>
// Read the command classes from XML
@ -833,6 +886,11 @@ void Node::WriteXML
snprintf( str, 32, "0x%.2x", m_security );
nodeElement->SetAttribute( "security", str );
if( !m_nodeInfoSupported )
{
nodeElement->SetAttribute( "nodeinfosupported", "false" );
}
nodeElement->SetAttribute( "query_stage", c_queryStageNames[m_queryStage] );
// Write the manufacturer and product data in the same format

View file

@ -129,8 +129,9 @@ namespace OpenZWave
QueryStage_None, /**< Query process hasn't started for this node */
QueryStage_ProtocolInfo, /**< Retrieve protocol information */
QueryStage_WakeUp, /**< Start wake up process if a sleeping node*/
QueryStage_ManufacturerSpecific1, /**< Retrieve manufacturer name and product ids if ProtocolInfo lets us */
QueryStage_NodeInfo, /**< Retrieve info about supported, controlled command classes */
QueryStage_ManufacturerSpecific, /**< Retrieve manufacturer name and product ids */
QueryStage_ManufacturerSpecific2, /**< Retrieve manufacturer name and product ids */
QueryStage_Versions, /**< Retrieve version information */
QueryStage_Instances, /**< Retrieve information about multiple command class instances */
QueryStage_Static, /**< Retrieve static information (doesn't change) */
@ -223,6 +224,8 @@ namespace OpenZWave
bool m_queryStageCompleted;
bool m_protocolInfoReceived;
bool m_nodeInfoReceived;
bool m_manufacturerSpecificClassReceived;
bool m_nodeInfoSupported;
//-----------------------------------------------------------------------------
// Capabilities
@ -260,6 +263,7 @@ namespace OpenZWave
uint8 GetSpecific()const{ return m_specific; }
string const& GetType()const{ return m_type; }
uint32 GetNeighbors( uint8** o_associations );
bool IsController()const{ return ( m_basic == 0x01 || m_basic == 0x02 ) && ( m_generic == 0x01 || m_generic == 0x02 ); }
private:
bool m_listening;
@ -340,6 +344,7 @@ namespace OpenZWave
*/
void RemoveCommandClass( uint8 const _commandClassId );
void ReadXML( TiXmlElement const* _nodeElement );
void ReadDeviceProtocolXML( TiXmlElement const* _ccsElement );
void ReadCommandClassesXML( TiXmlElement const* _ccsElement );
void WriteXML( TiXmlElement* _nodeElement );

View file

@ -195,6 +195,7 @@ bool ManufacturerSpecific::HandleMsg
GetNodeId(), node->GetManufacturerName().c_str(), node->GetProductName().c_str() );
ClearStaticRequest( StaticRequest_Values );
node->m_queryStageCompleted = true;
node->m_manufacturerSpecificClassReceived = true;
}
// Notify the watchers of the name changes
@ -387,6 +388,7 @@ bool ManufacturerSpecific::LoadConfigXML
return false;
}
node->ReadDeviceProtocolXML( doc->RootElement() );
node->ReadCommandClassesXML( doc->RootElement() );
delete doc;