Synchronous Serial Port Protocol messaging With NSOperationQueue/GCD
Synchronous Serial Port Protocol messaging With NSOperationQueue/GCD
- Subject: Synchronous Serial Port Protocol messaging With NSOperationQueue/GCD
- From: Vanni Parronchi <email@hidden>
- Date: Thu, 01 Aug 2013 12:03:01 +0200
hi everyone,
I'm writing a mac osx app that needs to talk to a serial device.
There's a well known protocol to adhere to (implemented in the device
firmware) and is a kind of a half-duplex synchronous protocol where if i
send a message to the device from my app i have to wait till i get a
response from the device, inspect it and then i'm allowed to send another
message. This has to go for several messages i need to send to the device.
Given this synchronous nature, i'm trying to keep the UI free so i'm doing
all the messaging stuff on background threads. My choice is to use
NSOperation and NSOperationQueue, where the queue is configured with
maxConcurrentOperations set to 1 in order to have a strict serial behavior
(this is due to the constraints given by the implemented protocol). How can
i make an NSOperation subclass waiting for a signal given by the serial
port delegate to make it fire isFinished KVO to the queue and make that
queue consequently execute the next NSOperation?
Does this approach make sense to you?
I'm open to any suggestions of course.
Thank you!
Vanni
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden