Delta Tau GEO BRICK LV User Manual

Page of 440
Turbo PMAC User Manual 
Writing a Host Communications Program
 
415
 
EthCmd.RequestType = VR_DOWNLOAD; 
EthCmd.Request     = VR_PMAC_SENDLINE; 
EthCmd.wValue      = 0; 
EthCmd.wIndex      = 0; 
EthCmd.wLength     = htons( (WORD)strlen(outstr)); 
strncpy((char *)&EthCmd.bData[0], 
         outstr 
         ,(WORD)strlen(outstr)); 
Example 
int CALLBACK PmacSockSendLine(char *outstr) 
   EthCmd.RequestType = VR_DOWNLOAD; 
   EthCmd.Request     = VR_PMAC_SENDLINE; 
   EthCmd.wValue      = 0; 
   EthCmd.wIndex      = 0; 
   EthCmd.wLength     = htons( (WORD)strlen(outstr)); 
   strncpy((char *)&EthCmd.bData[0],outstr,(WORD)strlen(outstr)); 
 
   send(sock, 
        (char *)&EthCmd, 
        ETHERNETCMDSIZE + strlen(outstr), 
       0); 
   recv(sock,(char *)&EthCmd,1 ,0); 
VR_PMAC_GETLINE 
This packet causes the Ethernet connection to return any available string that may be residing in the 
Turbo PMAC.  All characters up to a <CR>, <ACK>, or <LF> are returned. The available string in 
PMAC is returned and should be captured via an Ethernet recv command.  It is recommended that this 
function not be used.  Use VR_PMAC_GETBUFFER instead, as this function will retrieve multiple lines 
and will greatly enhance performance as opposed to using multiple calls of VR_PMAC_GETLINE
EthCmd.RequestType = VR_UPLOAD; 
EthCmd.Request     = VR_PMAC_GETLINE; 
EthCmd.wValue      = 0; 
EthCmd.wIndex      = 0; 
EthCmd.wLength     Not used 
Example 
int CALLBACK PmacSockGetLine(char *instr) 
   EthCmd.RequestType = VR_DOWNLOAD; 
   EthCmd.Request     = VR_PMAC_GETLINE; 
   EthCmd.wValue      = 0; 
   EthCmd.wIndex      = 0; 
   EthCmd.wLength     = htons( (WORD)strlen(outstr)); 
   strncpy((char *)&EthCmd.bData[0],outstr,(WORD)strlen(outstr)); 
 
   send(sock,(char *)&EthCmd,ETHERNETCMDSIZE,0); 
   recv(sock,(char *)&instr,255 ,0); 
VR_PMAC_GETBUFFER 
This packet causes the Ethernet connection to return any available string that may be residing in the 
Turbo PMAC.  All characters up to an <ACK> or <LF> are returned.   If a <BEL> or <STX> character is 
detected, only the data up to the next <CR> is returned.  The maximum amount of data that will ever be 
returned is 1400 bytes.  It is the caller’s responsibility to logically determine if there is more data to 
follow and if VR_PMAC_GETBUFFER must be called again to retrieve all of the data available.