You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.8 KiB
75 lines
1.8 KiB
|
3 months ago
|
export const DEVICE_DEFAULTS = {
|
||
|
|
wifi_static: '',
|
||
|
|
wifi_ip: '',
|
||
|
|
wifi_netmask: '',
|
||
|
|
wifi_gateway: '',
|
||
|
|
wifi_dns1: '',
|
||
|
|
wifi_dns2: '',
|
||
|
|
wifi_country_code: '',
|
||
|
|
eth_ip: '',
|
||
|
|
eth_netmask: '',
|
||
|
|
eth_gateway: '',
|
||
|
|
protocol_server_ip: '',
|
||
|
|
protocol_server_port: null,
|
||
|
|
update_server_ip: '',
|
||
|
|
update_server_port: null,
|
||
|
|
rtcm_server_ip: '',
|
||
|
|
rtcm_server_port: null,
|
||
|
|
opc_ua_server_ip: '',
|
||
|
|
opc_ua_server_port: null,
|
||
|
|
modbus_server_ip: '',
|
||
|
|
modbus_server_port: null,
|
||
|
|
lte_server_ip: '',
|
||
|
|
lte_server_port: null,
|
||
|
|
can_bus_type: '',
|
||
|
|
can_baudrate: null,
|
||
|
|
rs485_mode: '',
|
||
|
|
rs485_baudrate: null,
|
||
|
|
rs485_databits: null,
|
||
|
|
rs485_parity: '',
|
||
|
|
rs485_stopbits: null,
|
||
|
|
lte_ip: '',
|
||
|
|
lte_netmask: '',
|
||
|
|
lte_gateway: '',
|
||
|
|
lte_port: null,
|
||
|
|
log_save: 'off',
|
||
|
|
log_max_size: null,
|
||
|
|
log_max_duration: null,
|
||
|
|
WIFI_SSID: [{ wifi_ssid: '', wifi_passwd: '', wifi_security: 'none' }],
|
||
|
|
};
|
||
|
|
|
||
|
|
export const REGISTER_ID_MAP = {
|
||
|
|
reg_analog_input_level: 'analog_input_level',
|
||
|
|
ai0: 'ai0',
|
||
|
|
ai1: 'ai1',
|
||
|
|
di0: 'di0',
|
||
|
|
di1: 'di1',
|
||
|
|
reg_can_input: 'can_input',
|
||
|
|
reg_device_type: 'dev_type',
|
||
|
|
reg_dr_on_off: 'dr_on',
|
||
|
|
reg_equipment: 'equipment',
|
||
|
|
reg_two_byte_order: 'two_byte_order',
|
||
|
|
reg_four_byte_order: 'four_byte_order',
|
||
|
|
reg_protocol: 'protocol',
|
||
|
|
reg_speed_data_source: 'speed_data',
|
||
|
|
reg_version: 'version',
|
||
|
|
reg_equipment_id: 'equipment_id',
|
||
|
|
reg_meid: 'MEID',
|
||
|
|
};
|
||
|
|
|
||
|
|
const appState = {
|
||
|
|
lastLoadedRegisterData: {},
|
||
|
|
};
|
||
|
|
|
||
|
|
export function cloneDeviceDefaults() {
|
||
|
|
return JSON.parse(JSON.stringify(DEVICE_DEFAULTS));
|
||
|
|
}
|
||
|
|
|
||
|
|
export function getLastLoadedRegisterData() {
|
||
|
|
return { ...appState.lastLoadedRegisterData };
|
||
|
|
}
|
||
|
|
|
||
|
|
export function setLastLoadedRegisterData(data) {
|
||
|
|
appState.lastLoadedRegisterData = { ...(data || {}) };
|
||
|
|
}
|