PyOhNet - problem with IdArray
|
21-11-2016, 12:47 AM
(This post was last modified: 21-11-2016 01:10 AM by Latka.)
Post: #1
|
|||
|
|||
PyOhNet - problem with IdArray
Hi,
There seems to be a problem with the evented IdArray (at least from the Playlist service) (ie the PropertyIdArray() ). It gets returned as a list of integers instead of as a base64 encoded string, so I can't decode it. It looks like this: Code: [0, 0, 0, 127, 0, 0, 0, 128, 0, 0, 0, 129, 0, 0, 0, 130, 0, 0, 0, 131, Thanks, Latka |
|||
21-11-2016, 01:54 PM
Post: #2
|
|||
|
|||
RE: PyOhNet - problem with IdArray
(21-11-2016 12:47 AM)Latka Wrote: Hi, This is working as intended. ohNet internally decodes all base64 encoded strings into byte arrays. pyOhNet then returns this byte array as an array of integers representing the bytes (to permit printing/display of the data). The following code segment re-assembles this as a byte array Code: def _EncodeIdArray( aIdArray ): This will then give you an IdArray from the byte array Code: def _DecodeIdArray( encoded ): |
|||
21-11-2016, 11:44 PM
Post: #3
|
|||
|
|||
RE: PyOhNet - problem with IdArray
Hi rockfather,
Thanks for your clarification. With your provided functions it now works for me, thanks! Another thing, I realize I can do: res = proxy.SyncReadList (idarray) print res as an example of how to get the output from an action invocation. However I can't get my head around how the asynchronous version works and with the callback. Would it be possible to get an example of how to do for example the BeginReadList ( idarray ) End ReadList Invocation and callback? Thanks again for your time. |
|||
22-11-2016, 09:33 AM
Post: #4
|
|||
|
|||
RE: PyOhNet - problem with IdArray
(21-11-2016 11:44 PM)Latka Wrote: Hi rockfather, Take a look in the examples in https://github.com/openhome/ohNet/tree/m...OhNet/Test |
|||
22-11-2016, 09:44 AM
Post: #5
|
|||
|
|||
RE: PyOhNet - problem with IdArray
Hi rockfather,
Thanks for your response. I have looked there but failed to see anything but the Sync calls. |
|||
22-11-2016, 02:59 PM
(This post was last modified: 22-11-2016 03:37 PM by rockfather.)
Post: #6
|
|||
|
|||
RE: PyOhNet - problem with IdArray
(22-11-2016 09:44 AM)Latka Wrote: Hi rockfather, Ooops - I misread your request The Sync methods use the Async methods internally. These can be observed in the generated proxies. It may be worth looking at these to see what is going on. These need to be saved to disk when generated for you to view them - see the commented out block in _Device.py Example from Playlist service - you would need to mimic the SyncPlay() and _PlayActionComplete() methods to get asynch operation Code: def SyncPlay( self ): |
|||
22-11-2016, 06:11 PM
Post: #7
|
|||
|
|||
RE: PyOhNet - problem with IdArray
Thanks rockfather!
I will have a look at your example code. Regarding this: Quote:The Sync methods use the Async methods internally. Does this mean that the use of Sync functions is as good as the Begin/End equivalents in pyOhNet? The reason I am asking is because of the way these methods are described in the docs. In the control point stack pdf from 2011, pages 8-9, one can read the following: Quote:Each action is represented in a Proxy by three functions. Two of these are begin and end functions for Thanks again ![]() |
|||
23-11-2016, 10:58 AM
Post: #8
|
|||
|
|||
RE: PyOhNet - problem with IdArray
(22-11-2016 06:11 PM)Latka Wrote: Thanks rockfather! A call to SyncXXX() will block until the call responds (or fails/times out) A call to BeginXXX() will return immediately It is up to you which is better in the scenario you are working in. If you cannot proceed until the response to the call is known it is better to use Sync calls, if you can proceed then use the Begin/End calls The documentation snippet above is a bit misleading - only you know whether you need synchronous or asynchronous behavior - so it should not really suggest one way is preferable to the other. Note that there are other methods to run asynchronously (for example put the Sync call on its own thread) |
|||
23-11-2016, 12:59 PM
Post: #9
|
|||
|
|||
RE: PyOhNet - problem with IdArray
Thanks for the answer!
![]() |
|||
« Next Oldest | Next Newest »
|