This accessor sends and/or receives messages from an XBee radio located on a specified serial port on the host. The accessor lists all the serial ports that it finds as options, although most likely only some of these are actually XBee radio devices. It is quite tricky to get this accessor working, as you have to have properly configured the XBee devices, for example to be on the same network as each other and to use the same baud rate as specified in this accessor. Information about XBee devices can be found here:
Whenever an input is received on the
the data on that input is sent to the serial port, and then presumably over
Whenever a message is received from the serial port, that message is
produced on the
wrapup() is invoked, this accessor closes the serial port.
The send and receive types can be any of those supported by the host.
The list of supported types will be provided as options for the
receiveType parameters. For the Ptolemy II host, these include at
least 'string', 'number', and a variety of numeric types.
When type conversions are needed, e.g. when you send a double
sendType set to int, or an int with
sendType set to byte,
then a "primitive narrowing conversion" will be applied, as specified here:
For numeric types, you can also send an array with a single call to this.send(). The elements of the array will be sent in sequence all at once, and will be received in one batch and emitted as an array.
Accessors that extend this one can override the
to customize what is sent.
This accessor requires the 'xbee' module.
||The data to be sent over the radio.|
||The data received from the radio.|
||int||The port on the server to connect to. This defaults to the last (most recently added, presumably) serial port in the list of serial ports on the host.|
Initiate a connection to the server using the current parameter values, set up handlers for for establishment of the connection, incoming data, errors, and closing from the server, and set up a handler for inputs on the toSend() input port.
Set up the accessor by defining the parameters, inputs, and outputs.
Handle input on 'toSend' by sending the specified data over the radio.
Close the web socket connection.