VB.net or C# samples for using AirLink Raven XT


#1

Hello all. We are building a stream gauge that will use a AirLink Raven XT for communication. I assume that the gauge hardware will be connected to the Raven via USB or Serial port. The current plan is to have an .asp page (or possibly a vb.net exe) connect to the Raven, get a reading from the stream gauge, then store the data in a database on a hosted web server and then provide the stream flow via HTML or web services. This will be non-profit service for the kayaking community.

I have a good degree of database and vb.net programming skills, but I’ve never used wireless devices, serial ports or USB ports. I hoping to find some very simple vb.net (ideal) or C# code for connecting to the Raven, then connect to the stream gauge (assumed via serial or USB) to retrieve the reading, then have the reading passed back as a variable. I’d also like code for recording errors in the process.

Like I said, I’m new to a lot of this would appreciate responses with very basic info and very easy to use code samples.

Thanks!


#2

First, welcome.

May I ask what’s the options of interface and output of your stream gauge?
How to get the data from it?

As you are using Airlink, you may check below for overview of ALEOS and what is offered, the management service included may help:
sierrawireless.com/productsa … tware.aspx


#3

do you need a sample code in c# or vb which communicates with modem over serialport?
if so, i can share a simple c# sample which demonstrates how to communicate over serialport.

// add this in using list
using System.IO.Ports;

// define needed variables
SerialPort m_serialport = null;
string m_incomingBuffer = "";

private void InitSerialPort()
{
       m_seriPort = new SerialPort();
       m_seriPort.PortName = "COM1";
       m_seriPort.BaudRate = 115200;
       m_seriPort.Parity = Parity.None;
       m_seriPort.DataBits = 8;
       m_seriPort.StopBits = StopBits.One;
       m_seriPort.Handshake = Handshake.None;
       m_seriPort.DtrEnable = true;
       m_seriPort.RtsEnable = true;
       m_seriPort.DataReceived += new SerialDataReceivedEventHandler(m_seriPort_DataReceived);
}
private void OpenSerialPort()
{
        // you must do error handling here
       m_seriPort.Open();
}
private void CloseSerialPort()
{
      // you must do error handling here
      m_seriPort.Close();
}
private void SendData(string data)
{
      // you must do error handling here
      m_seriPort.Write(data);
}

// this callback function will be triggered when there is some data on serialport
void m_seriPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
       m_incomingBuffer += m_seriPort.ReadExisting();
 }

And you can communicate with modem by the following routine. Of course you need error checking again.

// create serial port object and set its variables
InitSerialPort();
// open serial port object
OpenSerialPort();
// send AT command to modem
SendData("AT\r");
// you will then get "OK\r\n" response in "m_seriPort_DataReceived" function. And then you can send any other command or just close the port.