Module Mindstorm_NXT.Message

module Message: sig .. end
Read and write messages from the 10 message queues. This can be thought as advanced direct commands.

Interesting information concerning this can be found in Sivan Toledo's paper: Analysis of the NXT Bluetooth-Communication Protocol.


type mailbox = [ `B0 | `B1 | `B2 | `B3 | `B4 | `B5 | `B6 | `B7 | `B8 | `B9 ] 
The 10 available mailboxes on the NXT brick.
type remote = [ `R0 | `R1 | `R2 | `R3 | `R4 | `R5 | `R6 | `R7 | `R8 | `R9 ] 
Due to the master-slave relationship, slave devices may not initiate communication with their master, so they store outgoing messages in these mailboxes.
val write : ?check_status:bool ->
'a Mindstorm_NXT.conn -> mailbox -> string -> unit
write conn box msg writes the message msg to the inbox box on the NXT. This is used to send messages to a currently running program.
check_status : whether to request a status code from the brick. If true (the default for this fonction), the NXT only send a reply when it is able to queue the message without overflowing the queue (this prevent message loss). If false, the message may delete the oldest message in the NXT queue if it is full (the NXT queues are 5 messages long).
val read : 'a Mindstorm_NXT.conn ->
?remove:bool ->
[ `B0
| `B1
| `B2
| `B3
| `B4
| `B5
| `B6
| `B7
| `B8
| `B9
| `R0
| `R1
| `R2
| `R3
| `R4
| `R5
| `R6
| `R7
| `R8
| `R9 ] -> string
read conn box returns the message from the inbox box on the NXT.
remove : if true, clears the message from the remote inbox. Default: false.