bep_sdk

1.5.6 • Public • Published

HOW TO USE

  1. npm i serialport@10.0.1 --legacy-peer-deps
  2. npm i bep_sdk --legacy-peer-deps
  3. import { bepSDK } from 'bep_sdk/publish';

example

bepSDK.ConnectBike(function(output){ console.log(output); });

functions

  1. ConnectBike(callback(Status));
  2. DisconnectBike(callback(Status));
  3. GetSystemInformation(callback(SystemInformation));
  4. GetRideStats(callback(RideStats));
  5. GetBatteryUsage(callback(BatteryUsage))
  6. GetErrorHistory(callback(ErrorRecords));
  7. ClearErrorHistory(callback(Status));
  8. GetErrors(callback(ErrorRecords));
  9. InitializeMotorParameters(MotorParameters, callback(Status));
  10. GetMotorParameters(callback(MotorParameters));
  11. SetMotorParameters(ModifiableMotorParameters, callback(Status));
  12. UploadFirmware(Component, callback(stream UploadFirmwareResponse));
  13. RunDiagnostics(DiagnosticRequest, callback(DiagnosticResponse));
  14. StartBatterySleepMode(callback(Status));
  15. SetPythonPath(Python, callback(Status));
  16. ExportLogsToFile(Logs, callback(Status));

Enumerations

message Logs { string FilePath = 0; bool Enable_Debug = 1; } message Python { string FilePath = 0; } enum ComponentType { MCU = 0; // Motor Control Unit HMI = 1; BATTERY = 2; }

enum MeasuringUnit { IMPERIAL = 0; // MI, MPH METRIC = 1; // KM, KPH }

enum DiagnosticTest { // Motor Diagnostic Tests TEST_SPEED_SENSOR = 0; TEST_TORQUE_SENSOR = 1; TEST_CADENCE_SENSOR = 2; TEST_THROTTLE_DEVICE = 3; TEST_MOTOR_DEVICE = 4; TEST_LIGHT_DEVICE = 5; TEST_BRAKE_SENSOR = 6; TEST_BATTERY_DEVICE = 7;

// HMI Diagnostic Tests
TEST_UP_KEY = 51; 
TEST_DOWN_KEY = 52;
TEST_POWER_KEY = 53;
TEST_BLE = 54;

}

/* Message Definitions */ message Empty {}

message Status { int32 code = 1; // 0 => OK string message = 2; }

message SystemInformation { Status status = 1; // Motor Information string motor_serial_number = 2; string motor_fw_version = 3; string motor_hw_version = 4;

// Proposed additions for Motor System Information
string motor_manufacturer = 5;
string motor_model = 6;
string motor_type = 7;
string motor_part_number = 8;
string motor_region_code = 9;

// HMI Information
string hmi_serial_number = 21;
string hmi_fw_version = 22;
string hmi_hw_version = 23;
string hmi_part_number = 24;
string hmi_region_code = 25;

// Battery Information
string battery_serial_number = 41;
string battery_fw_version = 42;
string battery_hw_version = 43;

}

message RideStats { Status status = 1; int32 odometer = 2; // km int32 total_riding_time = 3; // seconds float max_speed = 4; // km/hr int32 max_rpm = 5; // RPM

// Proposed additions
MeasuringUnit display_unit = 51;

}

message BatteryUsage { Status status = 1; int32 output_voltage = 2; // mV int32 output_current = 3; // mA int32 state_of_charge = 4; // % int32 cycle_count = 5; // Times int32 state_of_health = 6; // %
string last_charge_date = 7; // YYYYMMDD int32 total_discharge_capacity = 8; int32 full_charge_capacity = 9; int32 battery_rest_mAh = 10; int32 max_discharge_current = 11; int32 cell_temparature = 12; int32 max_discharge_temperature = 13; int32 max_charge_temperature = 14; }

message ErrorRecord { int32 code = 1; oneof record { int32 odometer_km = 2; int64 timestamp = 3; // epoch time in seconds } }

message ErrorRecords { Status status = 1; repeated ErrorRecord error_records = 2; }

message MotorParameters { Status status = 1; // Bike Information string bike_serial_number = 2; string bike_sku = 3; string bike_model = 4;

// Speed Configuration
int32 max_speed_pedal_assist = 11;
int32 max_speed_throttle_assist = 12;
int32 wheel_diameter_mm = 13;

// HMI or Display configurations
MeasuringUnit display_unit = 22;

// Accessories
bool walk_assist = 31;

// Aux
bool aux_output = 51;

}

message ModifiableMotorParameters { MeasuringUnit display_unit = 22; bool walk_assist = 31; bool aux_output = 51; }

message Component { ComponentType component = 1; }

message UploadFirmwareResponse { Status status = 1; string version = 2; int32 progress = 3; }

message DiagnosticRequest { DiagnosticTest test_name = 1; }

message DiagnosticResponse { Status status = 1; // status of the diagnostic request command repeated ErrorRecord error_records = 2; oneof value { int32 speed = 12; // output for TEST_SPEED_SENSOR int32 torque = 13; // output for TEST_TORQUE_SENSOR int32 cadence = 14; // output for TEST_CADENCE_SENSOR int32 voltage = 15; // output for TEST_THROTTLE_DEVICE, TEST_BATTERY_DEVICE bool switch_state = 16; // output for TEST_LIGHT_DEVICE } }

Readme

Keywords

none

Package Sidebar

Install

npm i bep_sdk

Weekly Downloads

8

Version

1.5.6

License

ISC

Unpacked Size

30.1 kB

Total Files

6

Last publish

Collaborators

  • bep.mis