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.
Converts XML to Configuration file (RXC)
Bool XmlToRxc(string xmlFileName, string rxcFileName)
[in] xmlFileName full Path of the XML configuration settings.
[out] rxcFileName full Path of the ReXgen binary configuration settings.
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);
}
Converts RXD to MF4, ASC, BLF, MAT, CSV
Bool ConvertData(string inputpath, string outputpath)
[in] Inputpath full Path of the RXD log file.
[out] outputpath full Path of the converted file (should include the output format extension).
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);
}
Gets the current firmware version of the logger.
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte GetFirmwareVersion(out ushort MajorVersion, out byte
MinVersion, out byte BranchVersion, out byte FwType);
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();
}
Sends the current configuration in RXC format to the logger
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte SendConfiguration(char[] FileName, out short Status);
[in] FileName
[out] Status
0 if successfully sent.
If the function returns 0, check Status.
Status 0 – Configuration OK
Status 1 – Bad Config
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");
}
}
}
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);
}
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte GetLogData(Char* FileName, uint StartSector, uint EndSector);
Gets the log count of the main partition.
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern UInt16 GetLogCount();
Number of Log Files in the eMMC
private void button2_Click(object sender, EventArgs e)
{
if (Connected)
richTextBox1.AppendText(Convert.ToString(GetLogCount()) + "\n");
}
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.
Re-flashes the logger with the firmware.bin file.
[DllImport("RGUSBdrv.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte ReflashLogger(char[] FileName, out short Status);
[in] FileName
[out] Status
0 if file successfully sent.
If the function returns 0 check Status.
Status 0 – Reflash OK
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();
}
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.
Starts live data streaming
unsigned char InitLiveData (unsigned char Channel)
Initialise live data mode
[in] Channel
C# Example:
Refer the example application code.
https://www.influxtechnology.com/rexgen-support
Downloads Section > API
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
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();
}
Checks the status of the connected device.
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
Returns the last conversion status
string LastConvertStatus()
The last conversion status.
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());
}
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