This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
namespace CANFDApiProxy.Messages
{
public class BatteryMessage
{
public decimal LoadV { get; set; }
public decimal Current { get; set; }
public decimal Power { get; set; }
public decimal Percent { get; set; }
public bool Enable { get; set; }
public override string ToString()
{
return $"LoadV: {LoadV}, Current: {Current}, Power: {Power}, Percent: {Percent}, Enable: {Enable}";
}
}
}

View File

@@ -0,0 +1,77 @@
using CANFDApiProxy.Requests;
using System;
using System.Collections.Generic;
using System.Text;
namespace CANFDApiProxy.Messages
{
public class CANConfigMessage
{
public List<CANConfig> CANConfigList { get; set; }
public Pipe Pipe { get; set; }
public string Status { get; set; }
public static CANConfigRequest CreateCanConfigRequest(CANConfigMessage canConfigMessage)
{
var request = new CANConfigRequest();
try
{
request.config = new config();
var CANConfigArray = canConfigMessage.CANConfigList.ToArray();
request.config.can1 = new CanConfigItem(CANConfigArray[0].Base_or_arb_bitrate, CANConfigArray[0].Base_or_arb_sjw, CANConfigArray[0].Data_bitrate, CANConfigArray[0].Data_sjw, CANConfigArray[0].Filetype, CANConfigArray[0].Included, CANConfigArray[0].Is_fd);
request.config.can2 = new CanConfigItem(CANConfigArray[1].Base_or_arb_bitrate, CANConfigArray[1].Base_or_arb_sjw, CANConfigArray[1].Data_bitrate, CANConfigArray[1].Data_sjw, CANConfigArray[1].Filetype, CANConfigArray[1].Included, CANConfigArray[1].Is_fd);
request.config.can3 = new CanConfigItem(CANConfigArray[2].Base_or_arb_bitrate, CANConfigArray[2].Base_or_arb_sjw, CANConfigArray[2].Data_bitrate, CANConfigArray[2].Data_sjw, CANConfigArray[2].Filetype, CANConfigArray[2].Included, CANConfigArray[2].Is_fd);
request.config.can4 = new CanConfigItem(CANConfigArray[3].Base_or_arb_bitrate, CANConfigArray[3].Base_or_arb_sjw, CANConfigArray[3].Data_bitrate, CANConfigArray[3].Data_sjw, CANConfigArray[3].Filetype, CANConfigArray[3].Included, CANConfigArray[3].Is_fd);
}
catch (Exception ex)
{
request.Status = ex.Message;
}
return request;
}
public override string ToString()
{
var sb = new StringBuilder();
sb.Append($"Pipe: {Pipe}, Status: {Status}, CanConfigList:");
if (null != CANConfigList)
{
foreach( var c in CANConfigList)
{
sb.Append(" ");
sb.Append(c.ToString());
}
}
return sb.ToString();
}
}
public class CANConfig
{
public CANConfig(string name, int base_or_arb_bitrate, int base_or_arb_sjw, int data_bitrate, int data_sjw, string filetype, bool included, bool is_fd)
{
Name = name;
Base_or_arb_bitrate = base_or_arb_bitrate;
Base_or_arb_sjw = base_or_arb_sjw;
Data_bitrate = data_bitrate;
Data_sjw = data_sjw;
Filetype = filetype;
Included = included;
Is_fd = is_fd;
}
public string Name { get; }
public int Base_or_arb_bitrate { get; set; }
public int Base_or_arb_sjw { get; set; }
public int Data_bitrate { get; set; }
public int Data_sjw { get; set; }
public string Filetype { get; set; }
public bool Included { get; set; }
public bool Is_fd { get; set; }
public override string ToString()
{
return $"Name={Name}, BaseBR={Base_or_arb_bitrate}, BaseSJW={Base_or_arb_sjw}, BR={Data_bitrate}, DataSJW={Data_sjw}, FT={Filetype}, Inc={Included}, fd={Is_fd}";
}
}
}

View File

@@ -0,0 +1,141 @@
namespace CANFDApiProxy.Messages
{
internal class CANInfoInternal
{
public Can1 can1 { get; set; }
public Can2 can2 { get; set; }
public Can3 can3 { get; set; }
public Can4 can4 { get; set; }
public Pipe pipe { get; set; }
public Battery battery { get; set; }
public Pwr pwr { get; set; }
public Status status { get; set; }
public Sts sts { get; set; }
}
internal class Can1
{
public string info { get; set; }
public string state { get; set; }
public float last_updated { get; set; }
public int std_data { get; set; }
public int std_remote { get; set; }
public int ext_data { get; set; }
public int ext_remote { get; set; }
public int err_frame { get; set; }
public float bus_load { get; set; }
public int overruns { get; set; }
public int base_or_arb_bitrate { get; set; }
public int base_or_arb_sjw { get; set; }
public int data_bitrate { get; set; }
public int data_sjw { get; set; }
public string filetype { get; set; }
public bool included { get; set; }
public bool is_fd { get; set; }
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
internal class Can2
{
public string info { get; set; }
public string state { get; set; }
public float last_updated { get; set; }
public int std_data { get; set; }
public int std_remote { get; set; }
public int ext_data { get; set; }
public int ext_remote { get; set; }
public int err_frame { get; set; }
public float bus_load { get; set; }
public int overruns { get; set; }
public int base_or_arb_bitrate { get; set; }
public int base_or_arb_sjw { get; set; }
public int data_bitrate { get; set; }
public int data_sjw { get; set; }
public string filetype { get; set; }
public bool included { get; set; }
public bool is_fd { get; set; }
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
internal class Can3
{
public string info { get; set; }
public string state { get; set; }
public float last_updated { get; set; }
public int std_data { get; set; }
public int std_remote { get; set; }
public int ext_data { get; set; }
public int ext_remote { get; set; }
public int err_frame { get; set; }
public float bus_load { get; set; }
public int overruns { get; set; }
public int base_or_arb_bitrate { get; set; }
public int base_or_arb_sjw { get; set; }
public int data_bitrate { get; set; }
public int data_sjw { get; set; }
public string filetype { get; set; }
public bool included { get; set; }
public bool is_fd { get; set; }
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
internal class Can4
{
public string info { get; set; }
public string state { get; set; }
public float last_updated { get; set; }
public int std_data { get; set; }
public int std_remote { get; set; }
public int ext_data { get; set; }
public int ext_remote { get; set; }
public int err_frame { get; set; }
public float bus_load { get; set; }
public int overruns { get; set; }
public int base_or_arb_bitrate { get; set; }
public int base_or_arb_sjw { get; set; }
public int data_bitrate { get; set; }
public int data_sjw { get; set; }
public string filetype { get; set; }
public bool included { get; set; }
public bool is_fd { get; set; }
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
public class Pipe
{
public string path { get; set; }
}
public class Pwr
{
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
public class Status
{
public bool pin { get; set; }
}
public class Sts
{
public bool blue { get; set; }
public bool green { get; set; }
public bool red { get; set; }
}
public class Battery
{
public bool enable { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System.Collections.Generic;
namespace CANFDApiProxy.Messages
{
public class CANInfoMessage
{
public List<CANInfo> CANInfoList { get; set; }
}
public class CANInfo
{
public CANInfo(string name, string info)
{
Name = name;
Info = info;
}
public string Name { get; }
public string Info { get; }
}
}

View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace CANFDApiProxy.Messages
{
public class CANStateMessage
{
public List<CANState> CANStateList { get; set; }
}
public class CANState
{
public CANState(string name, string state, float last_updated)
{
Name = name;
State = state;
Last_updated = last_updated;
}
public string Name { get; }
public string State { get; set; }
public float Last_updated { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using System.Collections.Generic;
namespace CANFDApiProxy.Messages
{
public class CANStatsMessage
{
public List<CANStats> CANStatsList { get; set; }
}
public class CANStats
{
public CANStats(string name, int std_data, int std_remote, int ext_data, int ext_remote, int err_frame, float bus_load
, int overruns, float last_updated)
{
Name = name;
Last_updated = last_updated;
Std_data = std_data;
Std_remote = std_remote;
Ext_remote = ext_remote;
Err_frame = err_frame;
Bus_load = bus_load;
Ext_data = ext_data;
Overruns = overruns;
}
public string Name { get; }
public float Last_updated { get; set; }
public int Std_data { get; set; }
public int Std_remote { get; set; }
public int Ext_data { get; set; }
public int Ext_remote { get; set; }
public int Err_frame { get; set; }
public float Bus_load { get; set; }
public int Overruns { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace CANFDApiProxy.Messages
{
public class CalibrationMessage
{
public int Calibration_date { get; set; }
public string Calibration_date_string { get; set; }
public override string ToString()
{
return $"Calibration_date: {Calibration_date}, Calibration_date_string: {Calibration_date_string}";
}
}
}

View File

@@ -0,0 +1,10 @@
namespace CANFDApiProxy.Messages
{
public class ClocksMessage
{
public bool? Rtc_present { get; set; }
public bool? Rtc_setup { get; set; }
public string System { get; set; }
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace CANFDApiProxy.Messages
{
public class DeviceInfoMessage
{
public string Kernel_version { get; set; }
public string Os_release { get; set; }
public string Serial_number { get; set; }
public string Version_number { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace CANFDApiProxy.Messages
{
public class DiagnosticsMessageRequest
{
public string format { get; set; }
public override string ToString()
{
return $"format: {format}";
}
}
}

View File

@@ -0,0 +1,8 @@
namespace CANFDApiProxy.Messages
{
public class ErrorMessage
{
public string Error { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace CANFDApiProxy.Messages
{
public class EventPinMessage
{
public bool? Armed { get; set; }
public bool? Event { get; set; }
public bool? Event_pin { get; set; }
public string File_name { get; set; }
public string Ok { get; set; }
public string Reply { get; set; }
public override string ToString()
{
return $"Armed: {Armed}, Event: {Event}, Event_pin: {Event_pin}, File_name: {File_name}, Ok: {Ok}, Reply: {Reply}";
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace CANFDApiProxy.Messages
{
public class LEDsMessage
{
public List<LED> LEDs { get; set; }
public Battery Battery { get; set; }
public Pwr Pwr { get; set; }
public Status Status { get; set; }
public Sts Sts { get; set; }
}
public class LED
{
public LED(string name, bool blue, bool green, bool red)
{
Name = name;
Blue = blue;
Green = green;
Red = red;
}
public string Name { get; }
public bool Red { get; }
public bool Green { get; }
public bool Blue { get; }
}
}

View File

@@ -0,0 +1,8 @@
namespace CANFDApiProxy.Messages
{
public class LEDsPostMessage
{
public string status { get; set; }
public string reply { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace CANFDApiProxy.Messages
{
public class NetworkMessage
{
public string Current_address { get; set; }
public bool Dhcp { get; set; }
public string Interface { get; set; }
public string Mac_address { get; set; }
public string Set_address { get; set; }
public string Ok { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace CANFDApiProxy.Messages
{
public class NtpMessage
{
public string Ntp { get; set; }
public string Fallback { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace CANFDApiProxy.Messages
{
public class PowerMessage
{
public bool Battery_enable { get; set; }
public bool Nvin_pin { get; set; }
public bool On_pin { get; set; }
public bool Power_fault { get; set; }
public string Status { get; set; }
public override string ToString()
{
return $"Battery_enable: {Battery_enable}, Nvin_pin: {Nvin_pin}, On_pin: {On_pin}, Power_fault: {Power_fault}, Status: {Status}";
}
}
}

View File

@@ -0,0 +1,15 @@
namespace CANFDApiProxy.Messages
{
public class RecordingMessage
{
public string Recording { get; set; }
public bool Autoarm { get; set; }
public string Recording_dir { get; set; }
public string Ok { get; set; }
public string Reply { get; set; }
public override string ToString()
{
return $"Recording: {Recording}, AutoArm: {Autoarm}, Recording_dir{Recording_dir}, Ok: {Ok}, Reply: {Reply}";
}
}
}

View File

@@ -0,0 +1,12 @@
namespace CANFDApiProxy.Messages
{
public class SerialMessage
{
public string Serial { get; set; }
public string Status { get; set; }
public override string ToString()
{
return $"Serial={Serial}, Status={Status}";
}
}
}

View File

@@ -0,0 +1,15 @@
namespace CANFDApiProxy.Messages
{
public class ServicesMessage
{
public Service[] services { get; set; }
}
public class Service
{
public bool Enabled { get; set; }
public string Name { get; set; }
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace CANFDApiProxy.Messages
{
public class StatusMessage
{
public string status { get; set; }
}
}

View File

@@ -0,0 +1,117 @@
namespace CANFDApiProxy.Messages
{
public class UsbStatsMessage
{
public Filesystem Filesystem { get; set; }
public Swissbit Swissbit { get; set; }
public Traffic Traffic { get; set; }
public override string ToString()
{
return $"FS: {Filesystem}, SB: {Swissbit}, TR: {Traffic}";
}
}
public class Filesystem
{
public string avail { get; set; }
public string filesystem { get; set; }
public string mounted { get; set; }
public string size { get; set; }
public string type { get; set; }
public string use_pct { get; set; }
public string used { get; set; }
public override string ToString()
{
return $"avail: {avail}, size: {size}, use%: {use_pct}, used: {used}";
}
}
public class Swissbit
{
public Lifetime_Info lifetime_info { get; set; }
public string model { get; set; }
public string path { get; set; }
public string serial { get; set; }
public override string ToString()
{
return $"serial: {serial}, ecc: {lifetime_info.total_ecc_errors}";
}
}
public class Lifetime_Info
{
public string controller_revision { get; set; }
public int correctable_ecc_errors { get; set; }
public Erase_Info[] erase_info { get; set; }
public string firmware_revision { get; set; }
public int flash_lbas_written { get; set; }
public bool global_bad_block_management { get; set; }
public bool global_wear_leveling { get; set; }
public bool overall_health_status { get; set; }
public int power_on_counter { get; set; }
public Spare_Block_Info spare_block_info { get; set; }
public int temperature_current { get; set; }
public int temperature_max { get; set; }
public int temperature_min { get; set; }
public int total_ecc_errors { get; set; }
public int total_erase_count { get; set; }
}
public class Spare_Block_Info
{
public bool count_prefail { get; set; }
public int count_threshold { get; set; }
public bool count_valid { get; set; }
public int count_value { get; set; }
public int minimum { get; set; }
public int number_of_units { get; set; }
public int[] per_unit_current { get; set; }
public int[] per_unit_initial { get; set; }
public int total_current { get; set; }
public int total_initial { get; set; }
public int worst_current { get; set; }
public int worst_initial { get; set; }
}
public class Erase_Info
{
public Average_Erase_Count average_erase_count { get; set; }
public int erase_count { get; set; }
public string flash_cell_mode { get; set; }
public Max_Erase_Count max_erase_count { get; set; }
public bool prefail { get; set; }
public Rated_Erase_Count rated_erase_count { get; set; }
public int threshold { get; set; }
public bool valid { get; set; }
}
public class Average_Erase_Count
{
public bool valid { get; set; }
public int value { get; set; }
}
public class Max_Erase_Count
{
public bool valid { get; set; }
public int value { get; set; }
}
public class Rated_Erase_Count
{
public bool valid { get; set; }
public int value { get; set; }
}
public class Traffic
{
public float average_mbps { get; set; }
public float current_mbps { get; set; }
public float mins_remaining { get; set; }
public override string ToString()
{
return $"ave: {average_mbps}mbps, current: {current_mbps}mbps, remaining: {mins_remaining}mins";
}
}
}

View File

@@ -0,0 +1,18 @@
namespace CANFDApiProxy.Messages
{
public class UsbTreeMessage
{
public Child[] children { get; set; }
public string name { get; set; }
public string path { get; set; }
public string type { get; set; }
}
public class Child
{
public Child[] children { get; set; }
public string name { get; set; }
public string path { get; set; }
public string type { get; set; }
}
}