Skip to content

Documentation

Maciej Sopyło edited this page Apr 18, 2018 · 6 revisions

This page contains documentation of the b6::Device class.

b6::Device::Device() constructor

Initializes libusb, unloads the kernel driver if necessary (GNU/Linux only), claims the charger's USB interface and requests information about the charger (core type, hw version, etc...).

b6::Device::~Device() destructor

Releases the charger's USB interface, re-attaches the kernel driver if necessary and frees libusb.

b6::SysInfo b6::Device::getSysInfo()

Reads current system settings from the charger.

name type description
@returns b6::SysInfo system settings saved in the charger

b6::ChargeInfo b6::Device::getChargeInfo()

Reads current charging information from the charger.

Keep in mind that this method will throw if an error occurs during charging!

name type description
@returns b6::ChargeInfo current charge information
@throws b6::ChargingError throws an error if any occurs during charging

b6::ChargeProfile b6::Device::getDefaultChargeProfile(b6::BATTERY_TYPE type)

Gets a sane (in my opinion) default charging profile for a battery type.

name type description
type b6::BATTERY_TYPE type of battery that will be charged
@returns b6::ChargeProfile default charging profile for type

void b6::Device::stopCharging()

Stops the charging process.

void b6::Device::startCharging(b6::ChargeProfile profile)

Starts the charging process using the specified profile.

name type description
profile b6::ChargeProfile the profile with charging settings to use

System settings

bool b6::Device::setCycleTime(int cycleTime)

Sets time between cycles used for Ni-* battery cycling. Returns false if the value is outside the supported range.

name type SI unit range description
cycleTime int minutes 1-60 time between Ni-* battery cycles
@returns bool whether the setting was successful

bool b6::Device::setTimeLimit(bool enabled, int limit)

Sets the safety time limit settings. Returns false if the value is outside the supported range.

name type SI unit range description
enabled bool whether to enable the limit
limit int minutes 1-720 time limit
@returns bool whether the setting was successful

bool b6::Device::setCapacityLimit(bool enabled, int limit)

Sets the safety capacity limit settings. Returns false if the value is outside the supported range.

name type SI unit range description
enabled bool whether to enable the limit
limit int mAh 100-50000 capacity limit
@returns bool whether the setting was successful

bool b6::Device::setTempLimit(int limit)

Sets the safety temperature limit settings. Returns false if the value is outside the supported range.

name type SI unit range description
limit int °C 20-80 temperature limit
@returns bool whether the setting was successful

bool b6::Device::setBuzzers(bool system, bool key)

Sets buzzer settings.

name type SI unit range description
system bool system buzzer (charging error, etc...)
key bool key buzzer
@returns bool whether the setting was successful

Device information

std::string b6::Device::getCoreType()

Returns the core type/version of the charger (basically the model).

name type description
@returns std::string charger core type/version

int b6::Device::getUpgradeType()

I have no idea what this is.

name type description
@returns int no idea

int b6::Device::getLanguageID()

Presumably gets the UI language id. Returns 1 for English.

name type description
@returns int language id

int b6::Device::getCustomerID()

I have no idea what this is. Not the serial number displayed in the charger's UI.

name type description
@returns int no idea

double b6::Device::getHWVersion()

Returns hardware revision number.

name type description
@returns double hardware version

double b6::Device::getSWVersion()

Returns the firmware version.

name type description
@returns double firmware version

bool b6::Device::isEncrypted()

I have no idea what this is.

name type description
@returns bool no idea

int b6::Device::getCellCount()

Returns the maximum number of cells the charger supports (6 or 8).

name type description
@returns int maximum number of cells supported by the charger

Misc

static bool b6::Device::isBatteryLi(b6::BATTERY_TYPE type)

Checks whether the provided battery type is a Li-* battery.

name type description
type b6::BATTERY_TYPE battery type to check
@returns bool whether type is a Li-* battery

static bool b6::Device::isBatteryNi(b6::BATTERY_TYPE type)

Checks whether the provided battery type is a Ni-* battery.

name type description
type b6::BATTERY_TYPE battery type to check
@returns bool whether type is a Ni-* battery