//Revision 0.3

IpcMessage Header
offset (Dword) value  description
0             0x5AFAFA5A   sync
1             time_sec :  timespec.sec
2             time_nsec: timesepc.nsec
3             serial number: increase by 1
4             src; source module id
5             dst;  dest module id
6             type: message/command type
7             size message size  including IpcMessage heade, at least 32 bytes) 


Unimation command definitions
XX XX is 16 bits checksum

offset ( byte)   value 	 description
0		0x82 	 Frame state
1               protol : must be 0x01(protocol version 1.0)
2               command sequence: increase by 1 : 0xFF-> 0x01
3               padding bytes: valid value 0-3
4-5             length : Command length : not including cmmand and terminators
6               cmmd id (cmmand id)
7               ext cmmd ( not used must be 0)
8~n             data  command payload
n~{n, n+1, n+2, n+3}, padding bytes : 0xaa
8 + length + (length + 2) % 4 + pad  

n+1		CR Terminator     0x0D
n+2		LF Terminoator    0x0A

CMD QUIT 0x51 ('Q') : ( Host -> Unimation Server)
5A FA FA 5A 00 00 00 00 01 02 03 04 01 00 00 00  02 00 00 00 03 00 00 00 51 00 00 00 2c 00 00 00
82 01 01 02 00 00 51 00 xx xx 0D 0A  

CMD Attach 0x41('A'): ( Host->Unimation Server)
-->
5A FA FA 5A 00 00 00 00 01 02 03 04 02 00 00 00  02 00 00 00 03 00 00 00 41 00 00 00 2c 00 00 00
82 01 02 02 00 00 41 00 xx xx 0d 0a

<-- 
5A FA FA 5A 00 00 00 00 01 02 03 04 03 00 00 00  03 00 00 00 02 00 00 00 61 00 00 00 30 00 00 00
82 01 03 02 02 00 61 00 0b 00 aa aa xx xx 0d 0a

CMD Detach 0x44 ('D') ( Host -> Unimation Server)
--> 
5A FA FA 5A 00 00 00 00 01 02 03 04 04 00 00 00 02 00 00 00 03 00 00 00 44 00 00 00 2c 00 00 00
82 01 04 02 00 00 44 00 xx xx 0d 0a
<-- 
5A FA FA 5A 00 00 00 00 01 02 03 04 05 00 00 00  03 00 00 00 02 00 00 00 64 00 00 00 2c 00 00 00
82 01 05 00 02 00 64 00 0b 00 0d 0a
5A FA FA 5A A9 01 00 00 80 F8 A9 32 04 00 00 00 03 00 00 00 02 00 00 00 64 00 00 00 30 00 00 00 
82 01 04 02 02 00 64 00 00 00 aa aa xx xx 0D 0A 

CMD Signal 0x53('S') ( Host->Unimation Server)
--> 
5A FA FA 5A 00 00 00 00 01 02 03 04 06 00 00 00 02 00 00 00 03 00 00 00 53 00 00 00 32 00 00 00
82 01 06 02 06 00 53 00 01 00 01 00 ff ff aa aa xx xx 0d 0a
<-- 
5A FA FA 5A 00 00 00 00 01 02 03 04 07 00 00 00  03 00 00 00 02 00 00 00 73 00 00 00 2c 00 00 00
82 01 07 00 02 00 73 00 0b 00 0d 0a
Note: Signal command payload is gpio_drv11j_buff data structure.
5A FA FA 5A 2A 02 00 00 00 5C 90 1D 05 00 00 00 03 00 00 00 02 00 00 00 73 00 00 00 30 00 00 00 
82 01 05 02 02 00 73 00 03 aa aa xx xx 00 0D 0A

CMD Read 0x52 ('R') ( Host->Unimation Server)
--> 
5A FA FA 5A 00 00 00 00 01 02 03 04 08 00 00 00 02 00 00 00 03 00 00 00 52 00 00 00 2c 00 00 00
82 01 08 00 00 00 52 00 xx xx 0d 0a
<-- 
5A FA FA 5A 00 00 00 00 01 02 03 04 09 00 00 00  03 00 00 00 02 00 00 00 72 00 00 00 2c 00 00 00
82 01 09 00 02 00 72 00 0b 00 0d 0a
5A FA FA 5A 88 02 00 00 00 9D 69 3A 06 00 00 00 03 00 00 00 02 00 00 00 72 00 00 00 30 00 00 00 
82 01 06 02 02 00 72 00 0D 00 aa aa xx xx 0D 0A

CMD Write 0x57 ('W') ( Host -> Unimation Server)
--> 82 00 14 00 24 01 0E 00 57 00 04 00 01 00 02 00 03 00 04 00 FF FF 0D 0A
5A FA FA 5A 00 00 00 00 01 02 03 04 0a 00 00 00 02 00 00 00 03 00 00 00 57 00 00 00 38 00 00 00
82 01 0a 02 0a 00 57 00 04 00 01 00 02 00 03 00 04 00 aa aa xx xx 0d 0a
<-- 82 00 0A 00 24 01 04 00 77 00 0B 00 0D 0A
5A FA FA 5A 00 00 00 00 01 02 03 04 0b 00 00 00  03 00 00 00 02 00 00 00 77 00 00 00 30 00 00 00
82 01 0b 02 02 00 77 00    0b 00      aa aa     xx xx 0d 0a

5A FA FA 5A 00 00 00 00 01 02 03 04 0A 00 00 00 02 00 00 00 03 00 00 00 57 00 00 00 38 00 00 00 
82 01 0A 02 0A 00 57 00 04 00 01 00 02 00 03 00 04 00 aa aa xx xx 0D 0A 
[2024-11-08 11:21:25.262]# RECV HEX>
5A FA FA 5A F8 02 00 00 C0 17 53 02 07 00 00 00 03 00 00 00 02 00 00 00 77 00 00 00 30 00 00 00 
82 01 07 02 02 00 77 00 0E 00 aa aa xx xx 0D 0A 

Note: payload after 0x57 is gpio_drv11j_buf data structure
{
  unsigned short size,
  unsigned short data[],
  unsigned short crc
}
CMD IO Control 0x49 ('I') ( Host -> Unimiation Server)
-->(v1)  82 00 0E 00 24 01 08 00 49 00 01 00 01 00 FF FF 0D 0A  # IOC command:    IOC_SIGTER_ENABLE 1
                                                  IOCSIGINTER_DISABLE 2
                                                  IOC_READ_DATA 3
                                                  IOC_WRITE_DATA 4
                                                  IOC_TIMEOUT    5
                                                  IOC_SET_BLOCKTIME 6
                                                  IOC_GET_BLOCKTIME 7
                                                  IOC_SEND_SIGNAL 8
                                                  IOC_DRV_ATTACH 9
                                                  IOC_DRV_DETACH 10
                                                  IOC_RESET_BUFFER 11
5A FA FA 5A 00 00 00 00 01 02 03 04 0c 00 00 00  02 00 00 00 03 00 00 00 49 00 00 00 30 00 00 00
82 01 0c 00 06 00 49 00 01 00 01 00 ff ff 0d 0a						  

Note: sub payload after the command token is gpio_drv11j_buf
{
 unsigned short size ( little endian),
 unsigned short data ( BWORD 16 bit)
 unsigned CRC ( 0xFF)
}
<--(v1) 82 00 0A 00 24 01 04 00 69 00 0B 00 0D 0A  
5A FA FA 5A 00 00 00 00 01 02 03 04 0d 00 00 00  03 00 00 00 02 00 00 00 69 00 00 00 2c 00 00 00
82 01 0d 00 02 00 69 00 0b 00 0d 0a	

CMD receive data from the controller (indication) 0x6d 'm' ( Unimation -> Host)
<-- (v1) 82 00 14 00 24 01 0E 00 6D 00 04 00 01 00 02 00 03 00 04 00 FF FF 0D 0A 
5A FA FA 5A 00 00 00 00 01 02 03 04 0e 00 00 00  03 00 00 00 02 00 00 00 6d 00 00 00 38 00 00 00
82 01 0e 02 0c 00 6d 00 04 00 01 00 02 00 03 00 04 00 ff ff aa aa 0d 0a
Note: response payload after command token is gpio_drv11J_buff data structure

CMD Unknow command response 0x7F
<-- (v1) 82 00 0A 00 24 01 04 00 7F 00 0B 00 0D 0A
5A FA FA 5A 00 00 00 00 01 02 03 04 0f 00 00 00  03 00 00 00 02 00 00 00 7f 00 00 00 2c 00 00 00
82 01 0f 00 02 00 7f 00 0b 00 0d 0a                                      


