Retrieving data from ADP/Hydra/Argonaut recorders using the fast binary transfer (i.e. as used by SONREC). The protocol is as follows: 1- User sends: DOWNLOAD [CR] where is the name of a file in the recorder as given by the DIR command (i.e. DEF001) 2- System responds: DOWNLOAD [CR][LF] OK [CR][LF] c 3- User sends: a 4- System responds: 5- User sends: a 6- System responds: 7- User sends: a 8- System responds: . . . . . . . . . . . . . . . N- System responds: N+1- System responds: [CR][LF] OK [CR][LF] A data packet consists of: unsigned int Nytes - 2-byte integer with the number of bytes in the packet including these 2 and the 2 for the checksum char Buf[Nbytes-4] - Nbytes-4 consecutive bytes of data Checksum - unsigned 2-byte integer with the checksum of the Nbytes-4 bytes in Buf only. This checksum is computed with the function "ComputeCheckSum" shown below. In the file description packet the buf sent is simply a file description data structure as defined below. All other data packets are normally 1024 bytes long, except for the last data packet which may be smaller. Each data packet after the file description packet is simply an exact image of the data in the file being downloaded. The user should verify the integrity of each packet by comparing the checksum in the packet to the checksum computed from the packet data itself. If they don't match, the user can request the same packet to be resent by simply sending the character "r" to the system, instead of the "a", as many times as needed. /*=========================================================================*/ /* */ /* Definition of DateTime structure used by other ADP data structures */ /* */ /* */ typedef struct { int year; char day, month, minute, hour, sec100, second; } DateTimeType; /* */ /* */ /*=========================================================================*/ /*=========================================================================*/ /* */ /* Definition of file description structure used by the ADP recorder */ /* */ /* */ typedef struct _RecFileDescType { char FileName[13]; /* Same as given by DIR command */ /* i.e. DEF001 */ long FileSize; /* In bytes */ int FileIndex; /* File sequence number within recorder */ char Attrib; /* 0-normal file; */ /* 1-overwritten in buffer mode */ DateTimeType DateTime; /* Date/time file was created in recorder*/ } RecFileDescType; /* */ /* */ /*-------------------------------------------------------------------------*/ /*===========================================================================*/ /* */ /* Check sum computation in for recorder transfer */ /* */ #define CHECK_SUM_OFFSET 0xA596 unsigned int ComputeCheckSum( unsigned char *buf, int n ) { int i; unsigned int ChkSum = CHECK_SUM_OFFSET; for(i=0;i