2. Watch Face Operation Interface

WatchOpImpl

Interface Name

Parameters

Return Value

Description

registerOnWatchCallback

OnWatchCallback: Watch Event Callback Listener

void

Register watch event callback

unregisterOnWatchCallback

OnWatchCallback: Watch Event Callback Listener

Void

Unregister watch event callback

isOTAResource

Boolean: Result

Check if OTA resource

getOTAResourceFlag

int: OTA resource flag

Get OTA resource flag

restoreWatchSystem

OnFatFileProgressListener: Time-consuming Operation Progress Callback

Void

Restore watch system

updateWatchResource

resPath: Resource path
OnUpdateResourceCallback: Update Resource Callback

Void

Update watch resource

getCurrentBrowsePath

String: Current browse path

Get current browse path

listWatchList

OnWatchOpCallback<ArrayList<FatFile>> : Operation Result Callback

Void

Browse watch face files

getCurrentWatchInfo

OnWatchOpCallback<FatFile> : Operation Result Callback

Void

Get current watch face info

setCurrentWatchInfo

filePath: File path
OnWatchOpCallback<FatFile>: Operation Result Callback

Void

Set watch face

enableCustomWatchBg

filePath: File path
OnWatchOpCallback<FatFile>: Operation Result Callback

Void

Enable custom watch face background

createWatchFile

filePath: File storage path
isNoNeedCheck: Whether to skip version verification

Void

Insert watch face

deleteWatchFile

filePath: Watch system path

Void

Delete watch face

openWatchFile

filePath: Watch system path
OnWatchOpCallback<byte[]>: Operation Result Callback

Void

Open file

replaceWatchFile

filePath: File path

Void

Replace same-name file

jumpToUpdateResource

isExit: Whether to exit
OnWatchOpCallback<Boolean>: Operation Result Callback

Void

Jump to resource update page

writeResourceOTAFlag

flag: Protection flag
OnWatchOpCallback<Boolean>: Operation Result Callback

Void

Write resource OTA protection flag

getCustomWatchBgInfo

fatFilePath: Watch system path
OnWatchOpCallback<String>: Operation Result Callback

Void

Get custom background info for corresponding watch face

getWatchMessage

fatFilePath: Watch system path
OnWatchOpCallback<String>: Operation Result Callback

Void

Get watch face info

getWatchSysLeftSize

OnWatchOpCallback<Long>: Operation Result Callback

Void

Get remaining watch system space size

getResourceSpace

OnWatchOpCallback<Long>: Operation Result Callback

Void

Get resource storage space size

getWatchFileSize

fatFilePath: Watch face path
OnWatchOpCallback<WatchFileContent> : Operation Result Callback

Void

Get watch file size

requestDevicePower

OnWatchOpCallback<Boolean> : Operation Result Callback

Void

Get device power

pushMessageInfo

NotificationMsg: Notification info
OnWatchOpCallback<Boolean>: Operation Result Callback

Void

Push notification

removeMessageInfo

NotificationMsg: Notification info
OnWatchOpCallback<Boolean>: Operation Result Callback

Void

Remove notification

syncWeatherInfo

weather: Weather info
OnWatchOpCallback<Boolean>: Operation Result Callback

Void

Sync weather info

cancelTransfer

Boolean: Operation result

Cancel data transfer

getWatchConfigure

BluetoothDevice: Connected device object

WatchConfigure: Watch configuration info

Get cached watch configuration info

requestDeviceConfigure

OnWatchOpCallback<WatchConfigure> : Operation Result Callback

Void

Get watch configuration info

syncIrkMessage

OnWatchOpCallback<IrkMessage> : Operation Result Callback

Void

Synchronize IRK information

2.1. WatchManager Extended Interfaces

WatchManager provides the following commonly used extended interfaces in addition to watch face operations.

public interface IWatchManager extends IWatchOp {

    /**
     * Get the watch face file object by path
     *
     * @param path Path
     * @return FatFile Watch face file object
     */
    FatFile getWatchFileByPath(String path);

    /**
     * Send the write protection status command
     *
     * @param writeFlag Write protection status
     * @param callback  Command callback
     */
    void sendWriteProtectFlag(boolean writeFlag, OnWatchOpCallback<Boolean> callback);

    /**
     * Get the watch event callback object
     *
     * @return OnWatchCallback Watch event callback object
     */
    OnWatchCallback getCallback();
}

2.2. Watch Event Callback Listener

public abstract class OnWatchCallback extends OnRcspCallback {

    /**
     * Watch system initialization status callback
     *
     * @param code Initialization status
     *             <p>
     *             If 0, indicates initialization success; other values are error codes
     *             </p>
     */
    public void onWatchSystemInit(int code) {

    }

    /**
     * Watch system exception callback
     *
     * @param device    Device object
     * @param sysStatus Watch system status code
     */
    public void onWatchSystemException(BluetoothDevice device, int sysStatus) {

    }

    /**
     * External Flash write protection callback
     *
     * @param device    Device object
     * @param writeFlag Write protection status
     */
    public void onExternalFlashWriteFlag(BluetoothDevice device, boolean writeFlag) {

    }

    /**
     * Resource upgrade unfinished callback
     *
     * @param device Device object
     */
    public void onResourceUpdateUnfinished(BluetoothDevice device) {

    }

    /**
     * External Flash information callback
     *
     * @param device   Device object
     * @param flashMsg External Flash information
     */
    public void onExternalFlashMsg(BluetoothDevice device, ExternalFlashMsgResponse flashMsg) {

    }

    /**
     * Current watch face information callback
     *
     * @param device      Device object
     * @param fatFilePath File path
     */
    public void onCurrentWatchInfo(BluetoothDevice device, String fatFilePath) {

    }

    /**
     * Current power information callback
     *
     * @param device      Device object
     * @param batteryInfo Power information
     */
    public void onDevicePower(BluetoothDevice device, BatteryInfo batteryInfo) {

    }

    /**
     * Receive large data callback
     *
     * @param device Device object
     * @param type   Data type
     * @param data   Large data
     */
    public void onReceiveBigData(BluetoothDevice device, int type, byte[] data) {

    }

    /**
     * Large data processing error callback
     *
     * @param device Device object
     * @param error  Error event
     */
    public void onBigDataError(BluetoothDevice device, BaseError error) {

    }
}

2.3. Time-consuming Operation Progress Callback

public interface OnFatFileProgressListener {
    /**
     * Start
     *
     * @param filePath File path
     */
    void onStart(String filePath);

    /**
     * Progress callback
     *
     * @param progress Progress
     */
    void onProgress(float progress);

    /**
     * End
     *
     * @param result Result code
     */
    void onStop(int result);
}

Important

  1. Result codes refer to Error Code Definition

2.4. Update Resource Callback

public interface OnUpdateResourceCallback {
    /**
     * Update start callback
     *
     * @param filePath File path
     * @param total    Total number of resources to update
     */
    void onStart(String filePath, int total);

    /**
     * Update progress callback
     *
     * @param index    Update resource sequence number
     * @param filePath Update resource path
     * @param progress Update progress
     */
    void onProgress(int index, String filePath, float progress);

    /**
     * Update completion callback
     *
     * @param otaFilePath Firmware update file path
     *                    <p>Note: If empty, no need to enter update process, otherwise OTA update is required</p>
     */
    void onStop(String otaFilePath);

    /**
     * Update exception callback
     *
     * @param code    Error code
     * @param message Error information
     */
    void onError(int code, String message);
}

Important

  1. Result codes refer to Error Code Definition