Note that there are some explanatory texts on larger screens.

plurals
  1. POBlocking communication with ios accessory
    text
    copied!<p>It appears that Apple recommends using runloops for data communications with an external accessory. However, unless I am missing something, runloops are not very suitable for certain types of communications.</p> <p>We have an -experimental- accessory, to which we need to send an arbitrary number of bytes (up to, say 1024), which is followed by the accessory processing that data (variable delay, say between 1ms to 1000ms), followed by a variable length response (upto 1024 bytes) from the accessory.</p> <p>We would like to develop a static library (framework) for communicating with the accessory. Basically, this library will have a function, which takes an NSArray or NSMutableArray as an input, and returns NSArray or NSMutableArray, containing the response.</p> <p>The problem is that the recommended strategy of runloops isn't very suitable for this type of application. In the static library function, after preparing the data to be transmitted and scheduling the transmission, we have to enter some sort of "wait" state. However, this wait state can not be based on a polling method (such as waiting on a -synchronized- variable to be set by the receive routing), because then the receive routine never gets to execute (since they are on the same thread).</p> <p>If we don't use runloops, then we can not know when to read the data, because we don't know when the data will be arriving.</p> <p>Any ideas or recommendations on how to approach this problem? Are there any examples out there?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload