Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/examples/MinOZW/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ int main( int argc, char* argv[] )
#elif WIN32
string port = "\\\\.\\COM6";
#else
string port = "/dev/ttyUSB0";
// string port = "/dev/ttyUSB0";
string port = "/dev/ttyACM0";
#endif
if ( argc > 1 )
{
Expand Down
47 changes: 28 additions & 19 deletions cpp/src/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4082,18 +4082,18 @@ bool Driver::EnablePoll(ValueID const &_valueId, uint8 const _intensity)
// Not in the list, so we add it
PollEntry pe;
pe.m_id = _valueId;
pe.m_pollCounter = value->GetPollIntensity();
pe.m_pollCounter = 1; // poll immediately
m_pollList.push_back(pe);
value->Release();
m_pollMutex->Unlock();

// send notification to indicate polling is enabled
Notification* notification = new Notification(Notification::Type_PollingEnabled);
notification->SetHomeAndNodeIds(m_homeId, _valueId.GetNodeId());
notification->SetValueId(_valueId);
QueueNotification(notification);
Log::Write(LogLevel_Info, nodeId, "EnablePoll for HomeID 0x%.8x, value(cc=0x%02x,in=0x%02x,id=0x%02x)--poll list has %d items", _valueId.GetHomeId(), _valueId.GetCommandClassId(), _valueId.GetIndex(), _valueId.GetInstance(), m_pollList.size());
Log::Write(LogLevel_Info, nodeId, "EnablePoll for HomeID 0x%.8x, value(cc=0x%02x,in=0x%02x,id=0x%02x,int=%d)--poll list has %d items", _valueId.GetHomeId(), _valueId.GetCommandClassId(), _valueId.GetIndex(), _valueId.GetInstance(), value->GetPollIntensity(),m_pollList.size());
WriteCache();
value->Release();
return true;
}

Expand Down Expand Up @@ -4282,6 +4282,19 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent)
while (1)
{
int32 pollInterval = m_pollInterval;
// If the polling interval is for the whole poll list, calculate the time before the next poll,
// so that all polls can take place within the user-specified interval.
if (!m_bIntervalBetweenPolls)
{
if (pollInterval < 100)
{
Log::Write(LogLevel_Info, "The pollInterval setting is only %d, which appears to be a legacy setting. Multiplying by 1000 to convert to ms.", pollInterval);
pollInterval *= 1000;
}
if (m_pollList.size() != 0)
pollInterval /= (int32) m_pollList.size();
}


if (m_awakeNodesQueried && !m_pollList.empty())
{
Expand All @@ -4299,6 +4312,14 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent)
pe.m_pollCounter--;
m_pollList.push_back(pe);
m_pollMutex->Unlock();
// ready for next poll...insert the pollInterval delay
int i32;
i32 = Internal::Platform::Wait::Single(_exitEvent, pollInterval);
if (i32 == 0)
{
// Exit has been called
return;
}
continue;
}

Expand All @@ -4314,18 +4335,6 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent)
m_pollList.push_back(pe);
value->Release();
}
// If the polling interval is for the whole poll list, calculate the time before the next poll,
// so that all polls can take place within the user-specified interval.
if (!m_bIntervalBetweenPolls)
{
if (pollInterval < 100)
{
Log::Write(LogLevel_Info, "The pollInterval setting is only %d, which appears to be a legacy setting. Multiplying by 1000 to convert to ms.", pollInterval);
pollInterval *= 1000;
}
pollInterval /= (int32) m_pollList.size();
}

{
Internal::LockGuard LG(m_nodeMutex);
// Request the state of the value from the node to which it belongs
Expand Down Expand Up @@ -4399,7 +4408,7 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent)
else // poll list is empty or awake nodes haven't been fully queried yet
{
// don't poll just yet, wait for the pollInterval or exit before re-checking to see if the pollList has elements
int32 i32 = Internal::Platform::Wait::Single(_exitEvent, 500);
int32 i32 = Internal::Platform::Wait::Single(_exitEvent, pollInterval);
if (i32 == 0)
{
// Exit has been called
Expand Down Expand Up @@ -6986,7 +6995,7 @@ bool Driver::startConfigDownload(uint16 _manufacturerId, uint16 _productType, ui
ss << std::hex << std::setw(4) << std::setfill('0') << _productId << ".";
ss << std::hex << std::setw(4) << std::setfill('0') << _productType << ".";
ss << std::hex << std::setw(4) << std::setfill('0') << _manufacturerId << ".xml";
download->url = "http://download.db.openzwave.com/" + ss.str();
download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/" + ss.str();
download->filename = configfile;
download->operation = Internal::HttpDownload::Config;
download->node = node;
Expand All @@ -6998,7 +7007,7 @@ bool Driver::startConfigDownload(uint16 _manufacturerId, uint16 _productType, ui
bool Driver::startMFSDownload(string configfile)
{
Internal::HttpDownload *download = new Internal::HttpDownload();
download->url = "http://download.db.openzwave.com/mfs.xml";
download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/mfs.xml";
download->filename = configfile;
download->operation = Internal::HttpDownload::MFSConfig;
download->node = 0;
Expand All @@ -7010,7 +7019,7 @@ bool Driver::startMFSDownload(string configfile)
bool Driver::startDownload(string target, string file)
{
Internal::HttpDownload *download = new Internal::HttpDownload();
download->url = "http://download.db.openzwave.com/" + file;
download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/" + file;
download->filename = target;
download->operation = Internal::HttpDownload::Image;
Log::Write(LogLevel_Info, "Queuing download for %s (Node %d)", download->url.c_str(), download->node);
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/command_classes/AssociationCommandConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ namespace OpenZWave

if (Node* node = GetNodeUnsafe())
{
Group* group = node->GetGroup(groupIdx);
if ( NULL == group)
if (Group* group = node->GetGroup(groupIdx))
{
if (firstReports)
{
Expand Down