1. Basic Functions
1.1. Request Device Information
1.1.1. Actively Request Device Information
// Get the watch management object
final WatchManager watchManager = WatchManager.getInstance();
//Must ensure the device has completed RCSP protocol initialization and the Bluetooth manager is initialized
if (!watchManager.isRcspInit() || !BluetoothCore.isInit()) return;
//Build the request device information command
CommandBase command = CommandBuilder.buildGetDeviceInfoCmdForAll();
//Execute the query device information command
watchManager.sendRcspCommand(watchManager.getConnectedDevice(), command, new RcspCommandCallback<CommandBase>() {
@Override
public void onCommandResponse(BluetoothDevice device, CommandBase cmd) {
if (cmd.getStatus() != StateCode.STATUS_SUCCESS) {
// Request failed
onErrCode(device, new BaseError(WatchError.ERR_RESPONSE_BAD_STATUS)
.setCode(cmd.getStatus()));
return;
}
if (cmd instanceof GetTargetInfoCmd) {
GetTargetInfoCmd getTargetInfoCmd = (GetTargetInfoCmd) cmd;
TargetInfoResponse deviceInfo = getTargetInfoCmd.getResponse();
if (deviceInfo != null) {
//Device information
return;
}
}
onErrCode(device, new BaseError(WatchError.ERR_PARSE_DATA));
}
@Override
public void onErrCode(BluetoothDevice device, BaseError error) {
//Callback command exception
}
});
Note
TargetInfoResponse, Target Device Information
1.1.2. Get Cached Device Information
// Get the watch management object
final WatchManager watchManager = WatchManager.getInstance();
//Must ensure the device has completed RCSP protocol initialization and the Bluetooth manager is initialized
if (!watchManager.isRcspInit() || !BluetoothCore.isInit()) return;
// Get cached device information
DeviceInfo deviceInfo = watchManager.getDeviceInfo(watchManager.getConnectedDevice());
Note
DeviceInfo, Device Information
1.1.3. Device Information
public class DeviceInfo extends TargetInfoResponse {
/*=============================================*
* Alarm information
*=============================================*/
//Alarm information
private AlarmListInfo alarmListInfo;
//Alarm bell information
private List<DefaultAlarmBell> alarmDefaultBells;
//Alarm data structure version
private int alarmVersion;
//Alarm extension field support flag
private byte alarmExpandFlag = 0x00;
/*=============================================*
* Music playback information
*=============================================*/
//Music name
private MusicNameInfo musicNameInfo;
//Music status
private MusicStatusInfo musicStatusInfo;
//Music playback mode information
private PlayModeInfo playModeInfo;
//Aux playback status
private boolean isAuxPlay;
//Playable formats
private String playFileFormat;
//Cluster number of the currently playing file
private int cluster;
//Device index of the currently playing file
private byte currentDevIndex;
/*=============================================*
* Equalizer information
*=============================================*/
private EqPresetInfo eqPresetInfo;
private EqInfo eqInfo;
/*=============================================*
* Device storage information
*=============================================*/
private DevStorageInfo devStorageInfo;
/*=============================================*
* Light control information
*=============================================*/
private LightControlInfo lightControlInfo;
/*=============================================*
* Sound card information
*=============================================*/
private EqInfo soundCardEqInfo;
/*=============================================*
* FM/FM_TX information
*=============================================*/
private List<ChannelInfo> channelInfos; //Channel list
private FmStatusInfo fmStatusInfo; //Channel status
private float frequency; //Transmit frequency
/*=============================================*
* ID3 information
*=============================================*/
private ID3MusicInfo iD3MusicInfo;
/*=============================================*
* Noise processing (ANC) information
*=============================================*/
private VoiceMode currentVoiceMode; //Current noise processing mode information
private List<VoiceMode> voiceModeList; //All noise processing mode information
/*=============================================*
* Call information
*=============================================*/
private int phoneStatus; //Call status
/*=============================================*
* Extended function information
*=============================================*/
private ExpandFunction expandFunction;
/*=============================================*
* Health device settings
*=============================================*/
private HealthSettingInfo healthSettingInfo;
/*=============================================*
* Sports information
*=============================================*/
private SportsInfo sportsInfo;
/*=============================================*
* 4G network information
*=============================================*/
private NetworkInfo networkInfo;
/*=============================================*
* IRK information
*=============================================*/
private IrkMessage irkMessage;
}
1.1.4. Target Device Information
public class TargetInfoResponse extends CommonResponse implements IDataOp {
/**
* Protocol version number
*/
public final ProtocolVersion protocolVersion;
/**
* System information
*/
public final SystemInfo systemInfo;
/**
* Classic Bluetooth related information
*/
public final ClassicBtInfo classicBtInfo;
/**
* AI platform information
*/
public final AIPlatform aiPlatform;
/**
* Function configuration information
*/
public final FunctionConfiguration functionConfiguration;
/**
* Firmware version information
*/
public final Version version;
/**
* SDK type
*/
private int sdkType;
/**
* UBoot version information
*/
public final Version uBootVersion;
/**
* Upgrade configuration
*/
public final OTASettings otaSettings;
/**
* Upgrade status
*/
public final OTAState otaState;
/**
* Product information
*/
public final ProductInfo productInfo;
//Used for server to verify product information
/**
* Authentication key
*/
private String authKey;
/**
* Project identification code
*/
private String projectCode;
/**
* Protocol MTU
*/
public final ProtocolMTU protocolMtu;
/**
* Whether connection is allowed
*/
private int allowConnectFlag;
/**
* BLE information
*/
public final BleInfo bleInfo;
/**
* Transmitter information
*/
public final TransmitterInfo transmitterInfo;
/**
* Extended functions
*/
public final ExpandFunc expandFunc;
/**
* File operation configuration
*/
public final FileConfiguration fileConfiguration;
/**
* Custom version information
*/
private String customVersionMsg;
}
Note
ProtocolVersion, Protocol Version Information
SystemInfo, System Information
ClassicBtInfo, Classic Bluetooth Information
AIPlatform, AI Platform Authentication Information
FunctionConfiguration, Function Configuration Information
Version, Version Information
OTASettings, OTA Configuration
OTAState, OTA State
ProductInfo, Product Information
ProtocolMTU, Protocol MTU
BleInfo, BLE Information
TransmitterInfo, Transmitter Information
ExpandFunc, Extended Function Configuration
FileConfiguration, File Operation Configuration
1.1.4.1. Protocol Version Information
public class ProtocolVersion implements IDataOp {
/**
* Version number
*/
private int versionCode;
/**
* Version name
*/
private String versionName;
}
1.1.4.2. System Information
public class SystemInfo implements IDataOp {
/**
* Device power
*/
private int quantity;
/**
* Device volume
*/
private int volume;
/**
* Maximum volume
*/
private int maxVol;
/**
* Whether volume synchronization is supported
*/
private boolean supportVolumeSync = false;
/**
* Minimum power limit for upgrade (1 ~ 100)
*/
private int lowPowerLimit = 30;
}
1.1.4.3. Classic Bluetooth Information
public class ClassicBtInfo implements IDataOp {
/**
* Classic Bluetooth address
*/
private String edrAddr;
/**
* Protocols supported by Classic Bluetooth
*/
private int edrProfile = 0;
/**
* Classic Bluetooth connection status
*/
private int edrStatus = 0;
/**
* Whether GATT OVER BR/EDR is supported
*/
private boolean isSupportGattOverBrEDR;
/**
* Whether GATT OVER BR/EDR is preferred for connection
*/
private boolean isPriorityConnectGattOverBrEDR;
}
1.1.4.4. AI Platform Authentication Information
public class AIPlatform implements IDataOp {
/**
* Platform type
*/
private int platform;
/**
* Authentication code
*/
private String license;
}
1.1.4.5. Function Configuration Information
public class FunctionConfiguration implements IDataOp {
/**
* Function support mask
*/
private int functionMask;
/**
* Current mode
*/
private int curFunction;
/**
* Whether to show function icons when usb, sd, linein are offline
*/
private boolean supportOfflineShow;
/**
* Whether usb is supported
*/
private boolean supportUsb = true;
/**
* Whether sd0 is supported
*/
private boolean supportSd0 = true;
/**
* Whether sd1 is supported
*/
private boolean supportSd1 = true;
/**
* Whether to hide network radio
*/
private boolean hideNetRadio;
}
1.1.4.6. Version Information
public class Version implements IDataOp {
/**
* Device version name
*/
private String versionName;
/**
* Device version information
*/
private int versionCode;
}
1.1.4.7. OTA Configuration
public class OTASettings implements IDataOp {
/**
* Whether dual backup upgrade is supported
* <p>Single backup [false], the reconnection process needs to be disconnected;
* <br/>Dual backup [true], the reconnection process does not need to be disconnected</p>
*/
private boolean isSupportDoubleBackup;
/**
* Whether the boot loader needs to be downloaded
*/
private boolean isNeedBootLoader;
/**
* Single backup OTA connection method
* <p>
* 0 -- Disabled<br/>
* 1 -- BLE <br/>
* 2 -- SP
* </p>
*/
private int singleBackupOtaWay;
/**
* Whether the reusable space special upgrade process is supported
*/
private boolean isSupportReuseSpaceOTA;
}
1.1.4.8. OTA State
public class OTAState implements IDataOp {
/**
* Invalid mode
*/
public static final int EXPAND_MODE_NONE = 0;
/**
* Update resource mode
*/
public static final int EXPAND_MODE_UPDATE_RESOURCE = 1;
/**
* Reusable space special upgrade mode - resource update only
*/
public static final int EXPAND_MODE_REUSE_SPACE_OTA_ONLY_RESOURCE = 2;
/**
* Reusable space special upgrade mode - firmware program upgrade only
*/
public static final int EXPAND_MODE_REUSE_SPACE_OTA_ONLY_CODE = 3;
/**
* Mandatory upgrade flag
*/
private int mandatoryUpgradeFlag;
/**
* Request upgrade flag
* <p>
* Value range: <br/>
* 0 : Normal upgrade<br/>
* 1 : Mandatory upgrade
* </p>
*/
private int requestOtaFlag;
/**
* Extended mode
* <p>
* Value range:<br/>
* 0 : Invalid mode <br/>
* 1 : Update resource mode <br/>
* 2 : Reusable space special upgrade mode - resource update only <br/>
* 3 : Reusable space special upgrade mode - firmware program upgrade only
* </p>
*/
private int expandMode;
}
1.1.4.9. Product Information
public class ProductInfo implements IDataOp {
/**
* Vendor ID
*/
private int vid;
/**
* Product ID
*/
private int pid;
/**
* Customer ID
*/
private int uid;
}
1.1.4.10. Protocol MTU
public class ProtocolMTU implements IDataOp {
/**
* Send MTU
*/
private int sendMtu = RcspConstant.DEFAULT_PROTOCOL_MTU;
/**
* Receive MTU
*/
private int receiveMtu = RcspConstant.DEFAULT_PROTOCOL_MTU;
}
1.1.4.11. BLE Information
public class BleInfo implements IDataOp {
/**
* Whether to connect only to BLE devices
*/
private boolean bleOnly;
/**
* BLE address
*/
private String bleAddr;
/**
* Whether to use BLE to SPP mode
* <p>
* EDR is only enabled when BLE is connected, and only then can SPP be connected
* </p>
*/
private boolean isBLEToSppWay;
}
1.1.4.12. Transmitter Information
public class TransmitterInfo implements IDataOp {
/**
* Whether peripheral mode is supported
*/
private boolean emitterSupport;
/**
* 0x00: Normal mode 0x01: Peripheral mode
*/
private int emitterStatus;
}
1.1.4.13. Extended Function Configuration
public class ExpandFunc implements IDataOp {
/**
* Whether MD5 reading is supported
*/
private boolean isSupportMD5;
/**
* Whether in game mode
*/
private boolean isGameMode;
/**
* Whether find device is supported
*/
private boolean isSupportSearchDevice;
/**
* Whether sound card function is supported
*/
private boolean supportSoundCard;
/**
* Prohibit APP from adjusting device eq
*/
private boolean banEq;
/**
* Whether external Flash transfer function is supported
*/
private boolean supportExternalFlashTransfer;
/**
* Whether active noise cancellation function is supported
*/
private boolean supportAnc;
/**
* Whether reading firmware exception information is supported
*/
private boolean supportReadErrorMSg;
/**
* Whether hearing assist setting function is supported
*/
private boolean supportHearingAssist;
/**
* Whether the adaptive ANC algorithm is supported
*/
private boolean supportAdaptiveANC;
/**
* Whether device configuration information can be obtained
*/
private boolean supportDevConfigure;
/**
* Whether the smart pause-on-removal function is supported
*/
private boolean supportSmartNoPick;
/**
* Whether the scene denoising function is supported
*/
private boolean supportSceneDenoising;
/**
* Whether wind noise detection is supported
*/
private boolean supportWindNoiseDetection;
/**
* Whether vocal boost is supported
*/
private boolean supportVocalBooster;
/**
* Whether dual device connection is supported
*/
private boolean supportDoubleConnection;
}
1.1.4.14. File Operation Configuration
public class FileConfiguration implements IDataOp {
/**
* Whether large file transfer supports packet crc16 verification
*/
private boolean supportPackageCrc16;
/**
* Read firmware files with the new file name method (supports multiple devices)
*/
private boolean getFileByNameWithDev;
/**
* Whether the small file method is supported
*/
private boolean isSupportSmallFileTransfer;
}
1.1.5. Alarm Function Parameters
1.1.5.1. Alarm List Information
public class AlarmListInfo {
private int version; //Version number
private List<AlarmBean> alarmBeans; //Alarm list
}
Note
1.1.5.2. Alarm Data
public class AlarmBean {
//Index
private byte index;
//Name
private String name;
//Hour
private byte hour;
//Minute
private byte min;
//Type
private byte repeatMode;
//Extension field
private String reserved;
//Whether enabled
private boolean open;
//Bell type
private byte bellType;//0: Default type 1: Device file type
//Bell cluster number
private int bellCluster; //When bellType=0, this is the bell sequence number; when bellType=1, this is the file cluster number
//Bell name
private String bellName; //Valid when bellType=1
//Device index where the bell is located
private byte devIndex;//Valid when bellType=1
//Version number
private int version;
}
1.1.5.3. Default Alarm Bell
public class DefaultAlarmBell {
private String name; //Name
private int index; //Index
private boolean selected; //Whether selected
}
1.1.6. Device Music Function Parameters
1.1.6.1. Music Name Information
public class MusicNameInfo {
private int cluster; //Cluster number -- used to locate the file path
private String name; //Music name
}
1.1.6.2. Music Status Information
public class MusicStatusInfo {
private boolean isPlay; //Whether playing
private int currentTime; //Current playback time (unit: milliseconds)
private int totalTime; //Total duration (unit: milliseconds)
private int currentDev; //Device handle
}
1.1.6.3. Player Mode Information
public class PlayModeInfo {
private int playMode; //Playback mode
}
1.1.7. Sound Effect Adjustment Function Parameters
1.1.7.1. Sound Effect Preset Values
public class EqPresetInfo {
private int number;
private List<EqInfo> eqInfos;
private int[] freqs;
}
1.1.7.2. Sound Effect Information
public class EqInfo {
private int mode; //eq mode
private byte[] value = new byte[10]; //db values (10 bytes)
private int[] freqs = RcspConstant.DEFAULT_EQ_FREQS;
private boolean dynamic;
private int count = 10;
}
1.1.8. Storage Parameters
1.1.8.1. Storage Information
public class DevStorageInfo {
/**
* USB index
*/
public static final int INDEX_USB = 0;
/**
* SD0 index
*/
public static final int INDEX_SD0 = 1;
/**
* SD1 index
*/
public static final int INDEX_SD1 = 2;
/**
* Flash index
*/
public static final int INDEX_FLASH = 3;
/**
* LineIn index
*/
public static final int INDEX_LINE_IN = 4;
/**
* Flash2 index
*/
public static final int INDEX_FLASH2 = 5;
/**
* Flash3 index
*/
public static final int INDEX_FLASH3 = 6;
/**
* Protocol version
*/
private int version;
/**
* Storage information
*/
private final List<DevStorageState> storageStates;
/**
* Whether storage devices are reused
*/
private boolean isStorageReuse;
}
Note
1.1.8.2. Storage State
public class DevStorageState {
/**
* Whether online
*/
private boolean isOnline;
/**
* Storage index
*/
private int index;
/**
* Handle
*/
private int handle;
}
1.1.9. Light Control Function Reference
1.1.9.1. Light Control Information
public class LightControlInfo {
/*State*/
public final static int STATE_OFF = 0; //Off
public final static int STATE_ON = 1; //On
public final static int STATE_SETTING = 2; //Setting mode
/*Light mode*/
public final static int LIGHT_MODE_COLOURFUL = 0; //Colorful
public final static int LIGHT_MODE_TWINKLE = 1; //Twinkle
public final static int LIGHT_MODE_SCENE = 2; //Scene
/*Twinkle mode*/
public final static int TWINKLE_MODE_COLORFUL = 0; //Colorful
public final static int TWINKLE_MODE_RED = 1; //Red
public final static int TWINKLE_MODE_ORANGE = 2; //Orange
public final static int TWINKLE_MODE_YELLOW = 3; //Yellow
public final static int TWINKLE_MODE_GREEN = 4; //Green
public final static int TWINKLE_MODE_CYAN = 5; //Cyan
public final static int TWINKLE_MODE_BLUE = 6; //Blue
public final static int TWINKLE_MODE_PURPLE = 7; //Purple
/*Twinkle frequency*/
public final static int TWINKLE_FREQ_FAST = 0; //Fast twinkle
public final static int TWINKLE_FREQ_SLOW = 1; //Slow
public final static int TWINKLE_FREQ_BREATHE = 2; //Breathing light
public final static int TWINKLE_FREQ_MUSIC = 3; //Music twinkle
/*Scene mode*/
public final static int SCENE_MODE_RAINBOW = 0; //Rainbow
public final static int SCENE_MODE_HEARTBEAT = 1; //Heartbeat
public final static int SCENE_MODE_CANDLELIGHT = 2; //Candlelight
public final static int SCENE_MODE_NIGHT_LIGHT = 3; //Night light
public final static int SCENE_MODE_STAGE = 4; //Stage
public final static int SCENE_MODE_COLORFUL_BREATHING = 5; //Colorful breathing
public final static int SCENE_MODE_RED_BREATHING = 6; //Red breathing
public final static int SCENE_MODE_GREEN_BREATHING = 7; //Green breathing
public final static int SCENE_MODE_BLUE_BREATHING = 8; //Blue breathing
public final static int SCENE_MODE_GREEN_MOOD = 9; //Green mood
public final static int SCENE_MODE_BEAUTIFUL_SUNSET = 10; //Beautiful sunset
public final static int SCENE_MODE_MUSIC_RHYTHM = 11; //Music rhythm
private int switchState; //Switch state
private int lightMode; //Light mode
private int color; //Color value
private int twinkleMode; //Twinkle mode
private int twinkleFreq; //Twinkle frequency
private int sceneMode; //Scene mode
private int hue; //Hue, range: 0-360
private int saturation; //Saturation, range: 0-100
private int luminance; //Luminance, range: 0-100
}
1.1.10. FM Function Parameters
1.1.10.1. FM Channel Information
public class ChannelInfo {
/**
* Sequence number
*/
private int index;
/**
* Frequency point
*/
private float freq;
}
1.1.10.2. FM Status Information
public class FmStatusInfo {
private boolean isPlay; //Whether playing
private int channel; //Frequency point
private float freq; //Frequency
private int mode; //Mode
}
1.1.11. ID3 Information
public class ID3MusicInfo implements Parcelable {
// Song title
private String title;
// Composer
private String artist;
// Album
private String album;
// Sequence number
private int number = -1;
// Total playlist length
private int total;
// Total duration
private int totalTime;
// Type
private String genre;
// Current time
rivate int currentTime = -1;
// Playback status
private boolean playStatus;
}
1.1.12. Sound Effect Algorithm Parameters
1.1.12.1. Sound Effect Mode
public class VoiceMode implements Parcelable {
public final static int VOICE_MODE_CLOSE = 0;
public final static int VOICE_MODE_DENOISE = 1;
public final static int VOICE_MODE_TRANSPARENT = 2;
// Mode ID
private int mode = -1;
// Left ear maximum gain
private int leftMax;
// Left ear current gain
private int leftCurVal;
// Right ear maximum gain
private int rightMax;
// Right ear current gain
private int rightCurVal;
}