BLE commands
How to send a command to the bracelet
DeviceManager.getCurrentDevice()?.enqueueCommand(
request = ResetWatchRequest(),
onSuccess ={
view.findViewById<TextView>(R.id.action_result).text=
"Reset successful, the bracelet will restart"
},
onError ={
view.findViewById<TextView>(R.id.action_result).text= "Reset error $it"
}
)
Command list
Get File Size
GetFileSizeRequest(val file: FileOnWatch)
Description: (type: Get) The size of a file in bytes.
File’s Capacity: from SDK 0.8.0
Give the file’s capacity in percent: 0 if the file is empty, 100 if full, null if not applicable (a file that doesn’t exist on the bracelet, PPG2 for B1 for example)
bleDevice.enqueueCommand(
request = GetFileSizeRequest(FileOnWatch.ACTIVITY),
onSuccess = {
val hardwareId = DeviceManager.getCurrentDevice()?.deviceInfo?.hardwareId ?: HardwareId.UNKNOWN
Log.d("Corsano-SDK", "File size $it and capacity ${it.getCapacity(hardwareId)}")
}, onError = {
}
)
Get bracelet status (from SDK 0.8.0)
GetBraceletStatusRequest
Description: (type: Get) ) To get the status of the bracelet in terms of wearing, charging, etc.
Response:
data class Response(
val wearingState: Int, // wearing state, 0 to 4. 0 not wearing, 4 good wearing. For values 0, 1 , and 2, we can give a warning to the user for bad wearing.
val modeState: Int, // 0 or 1. 1 means the bracelet is in sleep-idle mode for saving battery. 0 means it is active.
val batteryPercentage: Int,
val isCharging: Boolean,
val idleState: Int //idle state: 0 to 4. 0 means the bracelet is not moving at all, 4 means the bracelet is in motion.
)
Erase all data (from SDK 0.8.0)
EraseAllRequest
Description: (type: Set) Asks the watch to erase all its data on the files (activity, sleep, hrv, ppg, etc)
Reset (from SDK 0.8.0)
ResetWatchRequest
Description: (type: Set) Asks the watch to restart.
The bracelet will restart (the LEDs will turn off then on)
Shutdown (from SDK 0.8.0)
ShutdownWatchRequest
Description: (type: Set) Command to ask the watch to shutdown.
Shutdown will turn off the bracelet. The bracelet will not measure data, and won’t be visible during the scan (no BLE advertisement).
The bracelet will be back on if it the charger is connected.
When the bracelet restart the LEDs turn on.
Reset (from SDK 0.8.0)
ResetWatchRequest
Description: (type: Set) Asks the watch to restart.
A reset is a restart of the Firmware on the bracelet.
The bracelet will restart (the LEDs will turn off then on)
It is important to resend the user settings and setup commands after a reset: time, user profile, bracelet plan These settings could have been saved by the Firmware and it could be able to restore it, but in some cases it is not, so it is better to resend it.
Get active mode
GetActiveModeRequest
Description: (type: Get) To ask the watch what the current mode is.
Return type
enum class DeviceMode(val id: Int) {
SHIPPING(0),
POWER_SAVING(1),
HRM(2),
SLEEP_TRACKING(3),
PREVENTICUS(4),
PREVENTICUS_SLEEP(5),
WORKOUT(6),
NORMAL(7),
CHARGING(8),
MAX_BATTERY(9)
}
Get battery level register
GetBatteryLevelRequest
Description: (type: Get) To ask the watch the battery percentage and the battery voltage.
Return type
data class BatteryLevel(
val level: Int,
val voltage: Int,
val isCharging: Boolean
)
Get user’s bedtime / risetime
GetBedtimeRequest
GetRisetimeRequest
Description: (type: Get) to ask the watch its current go to bed time or risetime (GMT).
Return type
data class HourMinuteRecord(val hour: Int, val minute: Int)
Get user’s birthday
GetBirthdayRequest
Description: (type: Get) to ask the watch its current date of birth.
Return type
data class Response(val year: Int, val month: Int, val day: Int)
Get firmware version
GetFwVersionRequest
Description: (type: Get) to ask the watch its current go to bed time or risetime (GMT).
Return type
FirmwareVersion(val major: Int, val minor: Int)
Get plan
GetPlanRequest
Description: (type: Get) to ask the watch its current plan
Return type
data class Response(
val devicePlan: DevicePlan,
val ppg2Frequency: Ppg2Frequency?,
val interval: Int?
)
devicePlan
The current plan of the device (0 to 5)
ppg2Frequency
(Only for 287-2b bracelet FW > 0.0.2.3) this indicates the frequency of the PPG2 measurements during hospital plans. Please refer to command APP_CMD_SET_PLAN for the details of its value. otherwise this byte is zero for other platforms and other plans.
interval
(Only for 287-2b bracelet FW > 0.0.2.24) this indicates the sampling rate of the activity metrics during hospital plans. Please refer to command APP_CMD_SET_PLAN for the details of its value. otherwise this byte is zero for other platforms and other plans.
Get user’s weight / height
GetHeightRequest
GetWeightRequest
Description: (type: Get) to ask the watch its current height (cm) or weight (kg).