void CMobileNode::startlistening() { PAYLOAD oPayload; // it has to listen continuously // while listening, it may move from one FA to another // so it has to send the change notification every 5 sec if ((m_pSockListen == NULL) || (m_pSockListen->bindToListen() == false)) return; if ((m_pSockSend == NULL) || (m_pSockSend->bindToSend() == false)) return; time_t start = time(NULL); do { bzero(&oPayload, sizeof oPayload); // lets give time out to 5 sec. this will allow us to send // registration packets even if mn is not receiving data. if (m_pSockListen->listen(oPayload, m_nRegTimeOut)) { oPayload.print(); } if ((time(NULL) - start) % m_nRegTimeOut== 0) { // send change notification. cout <<"Registration changed. " << endl ; sendChange(); } } while (true); }
void Camera::applyChanges() { LOCK_MUTEX; for (std::map<Parameter, String>::const_iterator it = requestedStringChanges.begin(); it != requestedStringChanges.end(); ++it) sendChange(it->first, it->second); requestedStringChanges.clear(); UNLOCK_MUTEX; LOCK_MUTEX; for (std::map<Parameter, Stop>::const_iterator it = requestedStopChanges.begin(); it != requestedStopChanges.end(); ++it) sendChange(it->first, it->second); requestedStopChanges.clear(); UNLOCK_MUTEX; }
void ComboBox::setSelectedId (const int newItemId, const NotificationType notification) { const ItemInfo* const item = getItemForId (newItemId); const String newItemText (item != nullptr ? item->name : String::empty); if (lastCurrentId != newItemId || label->getText() != newItemText) { label->setText (newItemText, dontSendNotification); lastCurrentId = newItemId; currentId = newItemId; repaint(); // for the benefit of the 'none selected' text sendChange (notification); } }
void ComboBox::setText (const String& newText, const NotificationType notification) { for (int i = items.size(); --i >= 0;) { const ItemInfo* const item = items.getUnchecked(i); if (item->isRealItem() && item->name == newText) { setSelectedId (item->itemId, notification); return; } } lastCurrentId = 0; currentId = 0; repaint(); if (label->getText() != newText) { label->setText (newText, dontSendNotification); sendChange (notification); } }