def sendAppCommand(command): success = False for a in appsDB.find({'id':command.deviceID}): app = pickle.loads(a.get('ffObject')) app.sendCommand(command) appObj = pickle.dumps(app) appsDB.update_one({'id':app.id},{'$set': {'ffObject':appObj}, '$currentDate': {'lastModified': True}}) success = True return success
def sendEventToApp(event): for a in appsDB.find({'listen': event.deviceID}): app = pickle.loads(a.get('ffObject')) app.sendEvent(event) appObj = pickle.dumps(app) appsDB.update_one({'id': app.id}, { '$set': { 'ffObject': appObj }, '$currentDate': { 'lastModified': True } })
def sendAppCommand(command): success = False for a in appsDB.find({'id': command.deviceID}): app = pickle.loads(a.get('ffObject')) app.sendCommand(command) appObj = pickle.dumps(app) appsDB.update_one({'id': app.id}, { '$set': { 'ffObject': appObj }, '$currentDate': { 'lastModified': True } }) success = True return success
def sendEventToApp(event): for a in appsDB.find({'listen':event.deviceID}): app = pickle.loads(a.get('ffObject')) app.sendEvent(event) appObj = pickle.dumps(app) appsDB.update_one({'id':app.id},{'$set': {'ffObject':appObj}, '$currentDate': {'lastModified': True}})