CommandParser (command_parser v0.1.4)
Link to this section Summary
Functions
Examples
iex> CommandParser.parse("+RESP:GTCFU,EF8031,862061041610857,Dott,OK190803003425,Z96VHS,,,0,0000000000002000,0,0.0,48,31.6,15.089599,37.520729,20221213140133,,0222,0010,9C73,1183,29&99,1,42,0,33541,4068,91,2,0,1,,0.0&0.04&5.6&1044.5&0&0&125&51002F&C50052&0&0&026014131315FFFFFF89&2,7,20221213140146,05B9$")
{:ok, %CommandParser.Okai.Report{event: "CFU", protocol_version: "EF8031", unique_id: "862061041610857", device_name: "Dott", vin: "OK190803003425", qr_code: "Z96VHS", report_type: 0, ecu_error_code: "0000000000002000", gps_accuracy: 0, speed: "0.0", azimuth: 48, altitude: "31.6", longitude: "15.089599", latitude: "37.520729", gps_utc_time: [2022, 12, 13, 14, 1, 33], empty: nil, mcc: 222, mnc: 10, lac: "9C73", cell_id: "1183", csq: "29&99", network_type: "1", state: 42, power_supply: 0, main_power_voltage: 33541, backup_battery_voltage: 4068, backup_battery_percentage: 91, ecu_error_type: 2, alive: 0, ecu_info: "0.0&0.04&5.6&1044.5&0&0&125&51002F&C50052&0&0&026014131315FFFFFF89&2", task_id: "", scooter_battery_percentage: "7", generated_time: [2022, 12, 13, 14, 1, 46], count_number: "05B9"}}
iex> CommandParser.parse("+RESP:GTNCN,EF803F,866833048022849,Dott,0K211027003708,YYRPXC,,,4,0000000000000000,0,0.0,0,119.4,9.210617,45.457018,20221214124317,,0222,0088,38AA,9C53,16&99,1,41,1,0,3974,80,0,0,1,,0.0&0.00&0.0&867.1&0&0&0&000000230000000601030000&000000CF000000ED05000000&0&0&00000000000000000000&2&2&00000000000000,0,20221214125313,3EB1$")
{:ok, %CommandParser.Okai.Report{event: "NCN", protocol_version: "EF803F", unique_id: "866833048022849", device_name: "Dott", vin: "0K211027003708", qr_code: "YYRPXC", report_type: 4, ecu_error_code: "0000000000000000", gps_accuracy: 0, speed: "0.0", azimuth: 0, altitude: "119.4", longitude: "9.210617", latitude: "45.457018", gps_utc_time: [2022, 12, 14, 12, 43, 17], empty: nil, mcc: 222, mnc: 88, lac: "38AA", cell_id: "9C53", csq: "16&99", network_type: "1", state: 41, power_supply: 1, main_power_voltage: 0, backup_battery_voltage: 3974, backup_battery_percentage: 80, ecu_error_type: 0, alive: 0, task_id: "", ecu_info: "0.0&0.00&0.0&867.1&0&0&0&000000230000000601030000&000000CF000000ED05000000&0&0&00000000000000000000&2&2&00000000000000", scooter_battery_percentage: "0", generated_time: [2022, 12, 14, 12, 53, 13], count_number: "3EB1"}}
iex> CommandParser.parse("+RESP:GTNCN,EF803D,862785046998467,Dott,OK191118009270,HY9MXE,,,0,0000000000000000,2,0.0,0,58.8,5.598594,50.652466,20221214115937,,0206,0001,1008,7CE6,20&0,1,41,1,0,3843,62,0,0,1,,0.0&0.00&0.0&2005.3&0&0&0&000000252021022601170000&000000CE2019090301020000&0&0&00000000000000000000&1&0&00000000000000,0,20221214125314,5F70$")
{:ok, %CommandParser.Okai.Report{event: "NCN", protocol_version: "EF803D", unique_id: "862785046998467", device_name: "Dott", vin: "OK191118009270", qr_code: "HY9MXE", report_type: 0, ecu_error_code: "0000000000000000", gps_accuracy: 2, speed: "0.0", azimuth: 0, altitude: "58.8", longitude: "5.598594", latitude: "50.652466", gps_utc_time: [2022, 12, 14, 11, 59, 37], empty: nil, mcc: 206, mnc: 1, lac: "1008", cell_id: "7CE6", csq: "20&0", network_type: "1", state: 41, power_supply: 1, main_power_voltage: 0, backup_battery_voltage: 3843, backup_battery_percentage: 62, ecu_error_type: 0, alive: 0, task_id: "", ecu_info: "0.0&0.00&0.0&2005.3&0&0&0&000000252021022601170000&000000CE2019090301020000&0&0&00000000000000000000&1&0&00000000000000", scooter_battery_percentage: "0", generated_time: [2022, 12, 14, 12, 53, 14], count_number: "5F70"}}
Examples
iex> CommandParser.run("priv/input.csv", "priv/output.csv") |> Enum.count
17
Link to this section Functions
Link to this function
parse(file)
examples
Examples
iex> CommandParser.parse("+RESP:GTCFU,EF8031,862061041610857,Dott,OK190803003425,Z96VHS,,,0,0000000000002000,0,0.0,48,31.6,15.089599,37.520729,20221213140133,,0222,0010,9C73,1183,29&99,1,42,0,33541,4068,91,2,0,1,,0.0&0.04&5.6&1044.5&0&0&125&51002F&C50052&0&0&026014131315FFFFFF89&2,7,20221213140146,05B9$")
{:ok, %CommandParser.Okai.Report{event: "CFU", protocol_version: "EF8031", unique_id: "862061041610857", device_name: "Dott", vin: "OK190803003425", qr_code: "Z96VHS", report_type: 0, ecu_error_code: "0000000000002000", gps_accuracy: 0, speed: "0.0", azimuth: 48, altitude: "31.6", longitude: "15.089599", latitude: "37.520729", gps_utc_time: [2022, 12, 13, 14, 1, 33], empty: nil, mcc: 222, mnc: 10, lac: "9C73", cell_id: "1183", csq: "29&99", network_type: "1", state: 42, power_supply: 0, main_power_voltage: 33541, backup_battery_voltage: 4068, backup_battery_percentage: 91, ecu_error_type: 2, alive: 0, ecu_info: "0.0&0.04&5.6&1044.5&0&0&125&51002F&C50052&0&0&026014131315FFFFFF89&2", task_id: "", scooter_battery_percentage: "7", generated_time: [2022, 12, 13, 14, 1, 46], count_number: "05B9"}}
iex> CommandParser.parse("+RESP:GTNCN,EF803F,866833048022849,Dott,0K211027003708,YYRPXC,,,4,0000000000000000,0,0.0,0,119.4,9.210617,45.457018,20221214124317,,0222,0088,38AA,9C53,16&99,1,41,1,0,3974,80,0,0,1,,0.0&0.00&0.0&867.1&0&0&0&000000230000000601030000&000000CF000000ED05000000&0&0&00000000000000000000&2&2&00000000000000,0,20221214125313,3EB1$")
{:ok, %CommandParser.Okai.Report{event: "NCN", protocol_version: "EF803F", unique_id: "866833048022849", device_name: "Dott", vin: "0K211027003708", qr_code: "YYRPXC", report_type: 4, ecu_error_code: "0000000000000000", gps_accuracy: 0, speed: "0.0", azimuth: 0, altitude: "119.4", longitude: "9.210617", latitude: "45.457018", gps_utc_time: [2022, 12, 14, 12, 43, 17], empty: nil, mcc: 222, mnc: 88, lac: "38AA", cell_id: "9C53", csq: "16&99", network_type: "1", state: 41, power_supply: 1, main_power_voltage: 0, backup_battery_voltage: 3974, backup_battery_percentage: 80, ecu_error_type: 0, alive: 0, task_id: "", ecu_info: "0.0&0.00&0.0&867.1&0&0&0&000000230000000601030000&000000CF000000ED05000000&0&0&00000000000000000000&2&2&00000000000000", scooter_battery_percentage: "0", generated_time: [2022, 12, 14, 12, 53, 13], count_number: "3EB1"}}
iex> CommandParser.parse("+RESP:GTNCN,EF803D,862785046998467,Dott,OK191118009270,HY9MXE,,,0,0000000000000000,2,0.0,0,58.8,5.598594,50.652466,20221214115937,,0206,0001,1008,7CE6,20&0,1,41,1,0,3843,62,0,0,1,,0.0&0.00&0.0&2005.3&0&0&0&000000252021022601170000&000000CE2019090301020000&0&0&00000000000000000000&1&0&00000000000000,0,20221214125314,5F70$")
{:ok, %CommandParser.Okai.Report{event: "NCN", protocol_version: "EF803D", unique_id: "862785046998467", device_name: "Dott", vin: "OK191118009270", qr_code: "HY9MXE", report_type: 0, ecu_error_code: "0000000000000000", gps_accuracy: 2, speed: "0.0", azimuth: 0, altitude: "58.8", longitude: "5.598594", latitude: "50.652466", gps_utc_time: [2022, 12, 14, 11, 59, 37], empty: nil, mcc: 206, mnc: 1, lac: "1008", cell_id: "7CE6", csq: "20&0", network_type: "1", state: 41, power_supply: 1, main_power_voltage: 0, backup_battery_voltage: 3843, backup_battery_percentage: 62, ecu_error_type: 0, alive: 0, task_id: "", ecu_info: "0.0&0.00&0.0&2005.3&0&0&0&000000252021022601170000&000000CE2019090301020000&0&0&00000000000000000000&1&0&00000000000000", scooter_battery_percentage: "0", generated_time: [2022, 12, 14, 12, 53, 14], count_number: "5F70"}}
Link to this function
run(input_filename, output_filename)
examples
Examples
iex> CommandParser.run("priv/input.csv", "priv/output.csv") |> Enum.count
17