Writing to the network port, Reading from the network, Sample code fragments – ChamSys MagicQ User Manual User Manual

Page 270: 2 writing to the network port, 3 reading from the network, 4 sample code fragments

Advertising
background image

MagicQ User Manual

241 / 355

32.2

Writing to the network port

Commands are transmitted from the network port using the Y macro in the Macro field of the Cue Stack window (use Page Right
to find the Macro field). In the View Settings view of the Setup Window, set the Ethernet Remote Protocol to “ChamSys Rem
tx”.

The format of Ethernet commands is Y followed by the data. To send Ethernet data, the Y command must be the only macro
command in the macro field. The Y command is followed by ASCII data contained within “ “ or ‘ ‘ or by decimal values
separated by commas. For example to send Hello World followed by a carriage return:

Y”Hello World”,10,13

To send the hexadecimal data stream 00 01 02 03 04

Y0,1,2,3,4

To send text only:

Y”abcedf”

To send several lines of text:

Y”Hello”,10,13,”World”,10,13

On the Ethernet the data above is encapsulated in the data field of ChamSys Ethernet Remote Protocol in the UDP packet.

Note that commas ‘,’ are not allowed within the ASCII data inside “ “ or ‘ ‘ . If you wish to send ‘,’ then you must send it as its
hexadecimal ASCII code.

32.3

Reading from the network

By default data received on the network is ignored. This can be changed to make MagicQ accept remote commands received on
the network port. In Setup, View Settings, set the Ethernet Remote Protocol to “ChamSys Rem rx”.

ChamSys Remote Protocol consists of simple commands consisting of a list parameter values separated by commas ‘,’ and ending
in a character A to Z (or a to z). Commands can contain spaces, tabs, and carriage returns; they are all ignored. See the section
on ChamSys Remote Protocol for further details.

32.4

Sample code fragments

The code fragments below show you could connect to MagicQ using simple C programming.

#define

REMOTE_ETHER_PORT 0x1999

#define

MAX_CREP_MSG 1000

typedef struct

\{

long32 chamsys;

word16 version;

byte seq_fwd;

byte seq_bkwd;

word16 length;

byte data;

} remote_ether_message_t;

int

remote_ether_sock = 0;

word16 remote_ether_fwd = 0;

word16 remote_ether_bkwd = 0;

int

remote_ether_init(

void

)

Advertising
This manual is related to the following products: