/* Friend methods for platform-listener to find/insert/remove
  * tokens with type-filtering */
 inline bool _hasToken(const std::string& path)
 {
     auto preCheck = m_tokens.find(path);
     if (preCheck != m_tokens.end())
         return true;
     return false;
 }
Exemplo n.º 2
0
 inline void _removeToken(const std::string& path) {
   auto preCheck = m_tokens.find(path);
   if (preCheck != m_tokens.end()) {
     DeviceToken& tok = *preCheck->second;
     std::shared_ptr<DeviceBase> dev = tok.m_connectedDev;
     tok._deviceClose();
     deviceDisconnected(tok, dev.get());
     m_tokensLock.lock();
     m_tokens.erase(preCheck);
     m_tokensLock.unlock();
   }
 }
Exemplo n.º 3
0
 inline bool _insertToken(std::unique_ptr<DeviceToken>&& token) {
   if (DeviceSignature::DeviceMatchToken(*token, m_types)) {
     m_tokensLock.lock();
     TInsertedDeviceToken inseredTok = m_tokens.insert(std::make_pair(token->getDevicePath(), std::move(token)));
     m_tokensLock.unlock();
     deviceConnected(*inseredTok.first->second);
     return true;
   }
   return false;
 }