L
Levin Alexander
Hi,
I am trying to write a some code that expresses a series of =20
Commands/Responses over a serial link.
In pseudocode, this is what I want to accomplish:
conv =3D Conversation.new(connection) { |x|
x.transmitinit)
x.wait_forok)
x.transmitget_user_input)
x.wait_foruser_data) { |message| response =3D message.text }
puts response
rescue TimeoutException =3D> e
x.retry if x.attempts < 3
}
conv.start
I suppose that something like that can be done with continuations and =20
coroutines (which I have never used before) Especially =20
<http://www.all-thing.net/Ruby/coroutines.html> looks useful.
I would really appreciate any advice on how to best implement all this. =
=20
Are there some projects/libraries that do something similar?
The interface I made up above could probably also be improved a lot and =20
I'd appreciate your thoughts and suggestions.
Thank You,
Levin
I am trying to write a some code that expresses a series of =20
Commands/Responses over a serial link.
In pseudocode, this is what I want to accomplish:
conv =3D Conversation.new(connection) { |x|
x.transmitinit)
x.wait_forok)
x.transmitget_user_input)
x.wait_foruser_data) { |message| response =3D message.text }
puts response
rescue TimeoutException =3D> e
x.retry if x.attempts < 3
}
conv.start
I suppose that something like that can be done with continuations and =20
coroutines (which I have never used before) Especially =20
<http://www.all-thing.net/Ruby/coroutines.html> looks useful.
I would really appreciate any advice on how to best implement all this. =
=20
Are there some projects/libraries that do something similar?
The interface I made up above could probably also be improved a lot and =20
I'd appreciate your thoughts and suggestions.
Thank You,
Levin