bep_sdk
v1.5.6
Published
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
Downloads
12
Readme
HOW TO USE
- npm i [email protected] --legacy-peer-deps
- npm i bep_sdk --legacy-peer-deps
- import { bepSDK } from 'bep_sdk/publish';
example
bepSDK.ConnectBike(function(output){ console.log(output); });
functions
- ConnectBike(callback(Status));
- DisconnectBike(callback(Status));
- GetSystemInformation(callback(SystemInformation));
- GetRideStats(callback(RideStats));
- GetBatteryUsage(callback(BatteryUsage))
- GetErrorHistory(callback(ErrorRecords));
- ClearErrorHistory(callback(Status));
- GetErrors(callback(ErrorRecords));
- InitializeMotorParameters(MotorParameters, callback(Status));
- GetMotorParameters(callback(MotorParameters));
- SetMotorParameters(ModifiableMotorParameters, callback(Status));
- UploadFirmware(Component, callback(stream UploadFirmwareResponse));
- RunDiagnostics(DiagnosticRequest, callback(DiagnosticResponse));
- StartBatterySleepMode(callback(Status));
- SetPythonPath(Python, callback(Status));
- 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 } }