RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world. RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino. To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org
Dependencies: EthernetInterface mbed-rtos
Diff: Packet.h
- Revision:
- 0:5f7bc45bc2e8
- Child:
- 1:f74116b37bc9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Packet.h Mon Jun 24 06:42:11 2013 +0000 @@ -0,0 +1,86 @@ +/******************************************* + * Packet.h + * @author Yuki Suga + * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010. + * @license LGPLv3 + *****************************************/ + +#ifndef PACKET_HEADER_INCLUDED +#define PACKET_HEADER_INCLUDED + +// Return Values +#define TIMEOUT 1 +#define DATA_TIMEOUT 2 +#define CHECKSUM_ERROR 3 + +#define INVALID_PACKET_INTERFACE 65 +#define INVALID_PACKET_DATASIZE 66 + +// Packet Settings +#define PACKET_HEADER_SIZE 2 +#define INTERFACE 0 +#define DATA_LENGTH 1 +#define DATA_START_ADDR 2 + +enum { + RTC_STATE_CREATED='C', + RTC_STATE_INACTIVE='I', + RTC_STATE_ACTIVE='A', + RTC_STATE_ERROR='E', + RTC_STATE_NONE='N', +}; + + +// Protocol +// Interface +#define INITIALIZE 'I' +#define ACTIVATE 'A' +#define DEACTIVATE 'D' +#define EXECUTE 'E' +#define ONERROR 'C' +#define RESET 'R' +#define GET_STATUS 'X' +#define GET_DATA 'G' +#define SEND_DATA 'S' +#define GET_PROFILE 'Z' +#define GET_CONTEXT 'B' +#define PACKET_ERROR 'F' +#define RECEIVE_DATA 'V' + +#define ADD_INPORT 'P' +#define ADD_OUTPORT 'Q' + +#define INPORT_ISNEW 'N' +#define INPORT_READ 'J' + +#define RTNO_OK '@' +#define RTNO_ERROR 'x' +#define RTNO_NONE '!' + +#define OUTPORT_WRITE 'W' + +// Communication Settings +#define PACKET_WAITING_TIME 100 // ms +#define PACKET_WAITING_DELAY 100 //us +#define PACKET_WAITING_COUNT (PACKET_WAITING_TIME*1000/PACKET_WAITING_DELAY) + + +#define TYPECODE_TIMED_BOOLEAN 'b' +#define TYPECODE_TIMED_CHAR 'c' +#define TYPECODE_TIMED_OCTET 'o' + + +#define TYPECODE_TIMED_LONG 'l' +#define TYPECODE_TIMED_FLOAT 'f' +#define TYPECODE_TIMED_DOUBLE 'd' + +#define TYPECODE_TIMED_BOOLEAN_SEQ 'B' +#define TYPECODE_TIMED_CHAR_SEQ 'C' +#define TYPECODE_TIMED_OCTET_SEQ 'O' + + +#define TYPECODE_TIMED_LONG_SEQ 'L' +#define TYPECODE_TIMED_FLOAT_SEQ 'F' +#define TYPECODE_TIMED_DOUBLE_SEQ 'D' + +#endif