Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/work'
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayRag committed Mar 8, 2017
2 parents 0383f36 + 94aeed9 commit 9df40fb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 2 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@

#deleteFile= YiAPICommandGen(1281, 'deleteFile', {}, {'param': '/tmp/fuse_d/DCIM'}, resultCB= lambda res: res['listing'])

startViewFinder= YiAPICommandGen(259, 'startViewFinder',
resultReq= {'msg_id': 7, 'type': 'vf_start'}
)
stopViewFinder= YiAPICommandGen(260, 'stopViewFinder',
resultReq= {'msg_id': 7, 'type': 'vf_stop'}
)
startViewFinder= YiAPICommandGen(259, 'startViewFinder')
stopViewFinder= YiAPICommandGen(260, 'stopViewFinder')


getSettings= YiAPICommandGen(3, 'getSettings',
Expand Down
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.3
add:
- 'start_album' and 'stop_album' events.

fix:
- clean blocking Timer after command done.
- *Viewfinder commands dont wait event enymore.


v1.2
More flexible communicating, tho still blocking.

Expand Down
8 changes: 6 additions & 2 deletions yiAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ def cmd(self, _command, _val=None):
runCmd= _command.makeCmd({'token':self.sessionId, 'heartbeat':self.tick}, _val)
self.listener.instantCB(runCmd)

threading.Timer(self.commandTimeout, runCmd.blockingEvent.set).start()
self.cmdSend(runCmd.cmdSend)
timeoutCmd= threading.Timer(self.commandTimeout, runCmd.blockingEvent.set)
timeoutCmd.start()

self.cmdSend(runCmd.cmdSend)

runCmd.blockingEvent.wait()
timeoutCmd.cancel()

logging.debug('Result %s' % runCmd.resultDict)

return runCmd.result()
Expand Down
2 changes: 2 additions & 0 deletions yiAPIListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def __init__(self, _sock):
"photo_taken": None,
"vf_start": None,
"vf_stop": None,
"enter_album": None,
"exit_album": None,
"battery": None,
"battery_status": None,
"adapter": None,
Expand Down

0 comments on commit 9df40fb

Please sign in to comment.