1. RCSP Basic Interface

RcspOpImpl

public interface IRcspOp {

    /**
     * Register Rcsp event callback
     *
     * @param callback RCSP event callback
     */
    void registerOnRcspCallback(OnRcspCallback callback);

    /**
     * Unregister RCSP event callback
     *
     * @param callback RCSP event callback
     */
    void unregisterOnRcspCallback(OnRcspCallback callback);

    /**
     * Register RCSP event listener
     *
     * @param listener RCSP event listener
     */
    void registerOnRcspEventListener(OnRcspEventListener listener);

    /**
     * Unregister RCSP event listener
     *
     * @param listener RCSP event listener
     */
    void unregisterOnRcspEventListener(OnRcspEventListener listener);

    /**
     * Send RCSP command
     *
     * @param device    Bluetooth device object
     * @param cmd       RCSP command
     * @param timeoutMs Timeout period
     *                  <p>1. Unit is milliseconds</p>
     * @param callback  Send callback
     */
    <T extends CommandBase> void sendCommandAsync(BluetoothDevice device, CommandBase cmd, int timeoutMs, RcspCommandCallback<T> callback);

    /**
     * Send RCSP response command
     *
     * @param device       Bluetooth device object
     * @param responseCmd RCSP response command
     * @param callback    Send callback
     */
    <T extends CommandBase> void sendCommandResponse(BluetoothDevice device, CommandBase responseCmd, RcspCommandCallback<T> callback);

    /**
     * Switch the connected device to the device in use
     * <p>
     * The switch result can be obtained via {@link OnRcspCallback#onSwitchConnectedDevice(BluetoothDevice)}
     * </p>
     *
     * @param device Connected device
     */
    void switchConnectedDevice(BluetoothDevice device);

    /**
     * Release resources
     */
    void release();
}

1.1. RCSP Event Callback Listener

public abstract class OnRcspCallback {

    /**
     * Rcsp protocol initialization callback
     *
     * @param device Connected device
     * @param isInit Initialization result
     */
    public void onRcspInit(BluetoothDevice device, boolean isInit) {

    }

    /**
     * Device-sent rcsp command callback
     *
     * @param device  Connected device
     * @param command RCSP command
     */
    public void onRcspCommand(BluetoothDevice device, CommandBase command) {

    }

    /**
     * Device-sent data command callback
     *
     * @param device  Connected device
     * @param dataCmd Data command
     */
    public void onRcspDataCmd(BluetoothDevice device, CommandBase dataCmd) {

    }

    /**
     * RCSP error event callback
     *
     * @param device Device object
     * @param error  Error information
     */
    public void onRcspError(BluetoothDevice device, BaseError error) {

    }

    /**
     * Mandatory upgrade callback
     *
     * @param device Device requiring mandatory upgrade
     */
    public void onMandatoryUpgrade(BluetoothDevice device) {

    }

    /**
     * Device connection status
     *
     * @param device  Bluetooth device
     * @param status  Connection status
     */
    public void onConnectStateChange(BluetoothDevice device, int status) {

    }

    /**
     * Callback for switching the connected and currently used device
     *
     * @param device Connected device
     */
    public void onSwitchConnectedDevice(BluetoothDevice device) {

    }


    /**
     * Send data callback
     *
     * @param device Connected device
     * @param data Send raw data
     */
    public void onPutDataToDataHandler(BluetoothDevice device, byte [] data){

    }

}

1.2. Device Event Push Listener

public abstract class OnRcspEventListener {

    /**
     * Device mode change callback
     *
     * @param device Bluetooth device
     * @param mode   Device current mode
     */
    public void onDeviceModeChange(BluetoothDevice device, int mode) {

    }

    /**
     * Device system volume change callback
     *
     * @param device Bluetooth device
     * @param volume Device system volume
     */
    public void onVolumeChange(BluetoothDevice device, VolumeInfo volume) {

    }

    /**
     * Device external storage change callback
     *
     * @param device      Bluetooth device
     * @param storageInfo Device information
     */
    public void onDevStorageInfoChange(BluetoothDevice device, DevStorageInfo storageInfo) {

    }

    /**
     * Device supported file format callback
     *
     * @param device     Bluetooth device
     * @param fileFormat Device supported file format
     */
    public void onFileFormatChange(BluetoothDevice device, String fileFormat) {

    }

    /**
     * Music song change callback
     *
     * @param device   Bluetooth device
     * @param nameInfo Music information
     */
    public void onMusicNameChange(BluetoothDevice device, MusicNameInfo nameInfo) {

    }

    /**
     * Music playback status callback
     *
     * @param device     Bluetooth device
     * @param statusInfo Music status
     */
    public void onMusicStatusChange(BluetoothDevice device, MusicStatusInfo statusInfo) {

    }

    /**
     * Playback mode change callback
     *
     * @param device       Bluetooth device
     * @param playModeInfo Playback mode information
     */
    public void onPlayModeChange(BluetoothDevice device, PlayModeInfo playModeInfo) {

    }

    /**
     * Device power change callback
     *
     * @param device      Bluetooth device
     * @param batteryInfo Power information
     */
    public void onBatteryChange(BluetoothDevice device, BatteryInfo batteryInfo) {

    }

    /**
     * Alarm list update callback
     *
     * @param device        Bluetooth device
     * @param alarmListInfo Alarm list
     */
    public void onAlarmListChange(BluetoothDevice device, AlarmListInfo alarmListInfo) {

    }

    /**
     * Default alarm ringtone list
     *
     * @param device Bluetooth device
     * @param bells  Default alarm ringtone list
     */
    public void onAlarmDefaultBellListChange(BluetoothDevice device, List<DefaultAlarmBell> bells) {

    }

    /**
     * Alarm reminder callback
     *
     * @param device    Bluetooth device
     * @param alarmBean Alarm information
     */
    public void onAlarmNotify(BluetoothDevice device, AlarmBean alarmBean) {

    }

    /**
     * Alarm stop callback
     *
     * @param device    Bluetooth device
     * @param alarmBean Alarm information
     */
    public void onAlarmStop(BluetoothDevice device, AlarmBean alarmBean) {

    }

   /**
     * Health data change callback
     *
     * @param device Device object
     * @param data   Real-time health data
     */
    public void onHealthDataChange(BluetoothDevice device, HealthData data) {

    }

    /**
     * Sensor data callback
     *
     * @param device Device object
     * @param type   Sensor type
     * @param data   Sensor data
     */
    public void onSensorLogDataChange(BluetoothDevice device, int type, byte[] data) {

    }


        /**
     * Health setting information callback
     *
     * @param device Device object
     * @param healthSettingInfo Health setting information
     */
    public void onHealthSettingChange(BluetoothDevice device, HealthSettingInfo healthSettingInfo) {

    }

    /**
     * Sports status callback
     *
     * @param device Device object
     * @param state  Sports status
     */
    public void onSportsState(BluetoothDevice device, int state) {

    }


    /**
     * Sports information change callback
     *
     * @param device     Device object
     * @param sportsInfo Sports information
     */
    public void onSportInfoChange(BluetoothDevice device, SportsInfo sportsInfo) {

    }
}

1.3. Operation Result Callback

public interface OnOperationCallback<T> {
    /**
     * Success callback
     *
     * @param result Result
     */
    void onSuccess(T result);

     /**
     * Failure callback
     *
     * @param error Failure information
     */
    void onFailed(BaseError error);
}

Important

  1. Result codes refer to Error Code Definition