Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The ReXgen Open API libraries contain various functions that the user can use to interact with the ReXgen Series hardware and the files generated from the ReXgen series Data loggers.
API documentation
Data Conversion Library
Device Library
Example Application
Checks the status of the connected device.
private void btnConvertRXD_Click(object sender, EventArgs e)
{
if (dlgopenRXD.ShowDialog() != DialogResult.OK)
return;
if (dlgSaveConvertedData.ShowDialog() != DialogResult.OK)
return;
RxLib.ConvertData(dlgopenRXD.FileName, dlgSaveConvertedData.FileName);
MessageBox.Show(RxLib.LastConvertStatus());
}
private void btnConvertRXD_Click(object sender, EventArgs e)
{
if (dlgopenRXD.ShowDialog() != DialogResult.OK)
return;
if (dlgSaveConvertedData.ShowDialog() != DialogResult.OK)
return;
RxLib.ConvertData(dlgopenRXD.FileName, dlgSaveConvertedData.FileName);
}
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern UInt16 GetLogCount();
private void button2_Click(object sender, EventArgs e)
{
if (Connected)
richTextBox1.AppendText(Convert.ToString(GetLogCount()) + "\n");
}
private void btnXMLToRXC_Click(object sender, EventArgs e)
{
if (dlgOpenXML.ShowDialog() != DialogResult.OK)
return;
if (dlgSaveRXC.ShowDialog() != DialogResult.OK)
return;
RxLib.XmlToRxc(dlgOpenXML.FileName, dlgSaveRXC.FileName);
}
Gets the set RTC time
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 GetDateTime();
Date time in UNIX Date time format
public static DateTime GetDateandTime()
{
uint uDateTime;
uDateTime = GetDateTime();
return DateTimeOffset.FromUnixTimeSeconds(uDateTime).DateTime;
}
private void button1_Click(object sender, EventArgs e)
{
if (Connected)
label1.Text = GetDateandTime().ToString();
}
The RxLibrary library contains the functions for converting XML to the Configuration file (RXC). It also allows users to perform functions like converting RXD to MF4, ASC, BLF, MAT, and CSV.
The dll is a .Net Standard 2.0 dll and works under Linux, too.
The function calls in the ReXgen API all have names starting with RxLib.
To build an application:
The user will need to reference RxLibrary.dll in your programs.
Stops live data streaming
unsigned char StopLiveData(unsigned char Channel)
stop sending live data
[in] Channel
Refer the example application code.
https://www.influxtechnology.com/rexgen-support
Downloads Section > API
Formats the SD Card.
C#
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte FormatSDCard(ushort FormatType, out short Status);
0 if success
1 if there is a problem with USB communication
Refer to the example application code.
https://www.influxtechnology.com/rexgen-support
Downloads Section > API
The RgUSBdrv library is used to interact with all the ReXgen devices (ReXgen, ReXgen Air etc.) from Influx. Using this function, the user can perform various functions on the ReXgen devices, such as set data/time, reflash logger, send config, get log count etc.
The user will need to import the DLL and create a wrapper.
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte GetFirmwareVersion(out ushort MajorVersion, out byte
MinVersion, out byte BranchVersion, out byte FwType);
public static string GetFirmware()
{
string[] FirmwareReleaseType = new string[4] { "", "A", "B", "RC" };
byte MinVersion, Res, BranchVersion, fwType;
ushort MajorVersion;
Res = GetFirmwareVersion(out MajorVersion, out MinVersion, out BranchVersion, out fwType);
return $"{MajorVersion}.{MinVersion}.{BranchVersion} {FirmwareReleaseType[fwType]}";
}
private void btnGetFirmware_Click(object sender, EventArgs e)
{
if (USBDllComm.Connected)
lblGetFirmware.Text = GetFirmware();
}
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte SendConfiguration(char[] FileName, out short Status);
private void btnSendConfiguration_Click(object sender, EventArgs e)
{
if (dlgOpenRxc.ShowDialog() == DialogResult.OK)
{
byte Res;
short Status;
if (Connected) //Check if the logger is connected
{
Res = SendConfiguration((dlgOpenRxc.FileName + '\0').ToCharArray(), out Status);
if (Res == 0)
{
if (Status != 0)
MessageBox.Show("Bad Config");
MessageBox.Show("Logger Configured Successfully");
}
else
MessageBox.Show("Communication Error");
}
}
}
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte GetLogData(Char* FileName, uint StartSector, uint EndSector);
Gets the Details of log from the eMMC storage
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte GetSDLogInfo(
ushort LogNumber,
IntPtr StartLogDateTime, IntPtr EndLogDateTime,
IntPtr LoggingTimeStart, IntPtr LoggingTimeEnd,
IntPtr LogStartDataSector, IntPtr LogEndDataSector,
IntPtr LogDataSize, IntPtr GUID, IntPtr FileName, IntPtr isEncrypted);
[in] LogNumber
Log Start and End Date Time
Logging Time start and End Time
Data Sector where logging started and Data Sector where logging ended
Log Data Size
GUID
File Name
Encryption Status
Refer the example application code.
https://www.influxtechnology.com/rexgen-support
Downloads Section > API
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte ReflashLogger(char[] FileName, out short Status);
private void btnReflash_Click(object sender, EventArgs e)
{
if (dlgOpenReflash.ShowDialog() == DialogResult.OK)
{
if (Connected) //Check if the logger is connected
{
timerReflash.Start();
//Using timer to start the reflash as Async() method
}
}
}
async Task<bool> Reflash(string fwFileName)
{
try
{
Cursor.Current = Cursors.WaitCursor;
lblStatus.Text = "Reflash procedure started...";
byte res = ReflashLogger((fwFileName + '\0').ToCharArray(), out Int16 Status);
bool error = res == 1 && Status != 0;
bool connected = false;
do
{
await Task.Delay(1000);
lblStatus.Text = "Logger is updating. Waiting to reconnect...";
connected = DeviceIsReady() > 0;
if (connected)
{
await Task.Delay(1000);
lblStatus.Text = "";
MessageBox.Show("Reflash completed successfully");
}
}
while (!connected);
string msg = error ? "Reflash error " + Status.ToString() : "Reflash Completed!";
lblStatus.Text = msg;
return !error;
}
catch (Exception e)
{
return false;
}
finally
{
Cursor.Current = Cursors.Default;
}
private async void timer1_Tick(object sender, EventArgs e)
{
timerReflash.Enabled = false;
await Reflash(dlgOpenReflash.FileName);
Close();
}
Sets logger date time in UNIX format.
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte SetDateTime(uint DateTimeUNIX);
[in] DateTimeUNIX
C# Example
private void btnSetDateTime_Click(object sender, EventArgs e)
{
uint unixTimestamp;
unixTimestamp = (UInt32)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
if (Connected)
SetDateTime(unixTimestamp);
}