RCM-4400W File Transfer Question

I have an RCM-4400W that I am using to gather data from a quadrature
encoder in a velocity/acceleration logging device.

I’ve run some of the sample programs to get the wireless interface up
and running using ad-hoc mode. No problem there.

What I’d like to do is log data on the Rabbit, and then have it
transfer this log information as a comma-delimited text file over the
wireless connection to a laptop PC running a web browser. Since I
don’t have experience doing this, I was looking for a little guidance
on this subject.

Would I use FTP? Are there any good Rabbit documents and/or samples
that demonstrate a similar function?

  • Thanks

I also need to learn how to send information over the network via HTTP and FTP. Can anyone provide a reference, please?

Myriad,

The sample programs provided with the Dynamic C and the separately-purchased RabbitWeb provided me with most of the information I needed.

In my particular case, I used the SSPEC_RESOURCE_XMEMFILE to define a “blank” .csv file containing the maximum amount of data that I could possibly gather. I then would populate the data whenever needed, and I could then download the data using HTTP. A hyperlink in my web interface would point to the .csv file in Rabbit memory. I did not end up needing or using FTP.

I hope that helps.

deka_ee

Thank you for the info!

Actually, I don’t need to host the files on the board itself. Data is collected and stored in flash, and when a known and secured wifi hotspot is available, the rabbit board should be able to send that data via FTP or HTTP. Because multiple boards are moving around the area, it’s not wanted for someone to know when a connection is made and then manually grab the data.

Does the reference you mentioned show how to be a client as well as a server?

Thanks for taking the time to answer my questions!

sending data via HTTP GET and POST is not so difficult.
After connecting to the network, use tcp_open() and sock_puts() to send a request to an ip. The server can then process it.


//change your data to base64 encoding
data = base64_encode("Can be normal text or raw data");
//url encode the data. only the '=' needs to be encoded for base64 data
for(i = 0; i < strlen(data); i++)
{
 temp[0] = data[i];
 temp[1] = 0;
 switch(temp[0])
 {
  case	'=': strcat(data_enc,"%3d");	break;
  case	' ': strcat(data_enc,"%20");	break;
  default	: strcat(data_enc,temp); break;
 }
}
bytes = 5 + strlen(data_enc); //add 5 because "text=" is 5 bytes long, see below
//use 
 between each header part and 

 to separate the header from the variable
 sprintf(buffer,"POST %s HTTP/1.1
Host: %s
Content-Length: %d",FILE,WEBSITE,bytes);
 strcat(buffer,"
Content-Type: application/x-www-form-urlencoded

");
 strcat(buffer,"text="); // text is the variable name on the server side
 strcat(buffer,data_enc); // bust be
 if(!ip)
 {
    ip=resolve(WEBSITE);
 }
    tcp_open(&s,0,ip,PORT,NULL);
    sock_wait_established(&s,0,NULL,&status);
    sock_mode(&s,TCP_MODE_ASCII);

    sock_puts(&s,buffer);
   while(tcp_tick(&s)) {
      sock_wait_input(&s,0,NULL,&status);
      if(sock_gets(&s,buffer,2048))
      {

      }
   }
    return 0;


   sock_err:
   switch(status) {
      case 1: /* foreign host closed */
         printf("User closed session
");
         break;


      case -1: /* time-out */
         printf("
Connection timed out
");
         break;
   }

hopefully that works for anyone. it’s my first time using this.