Zepp Theme

Zepp OS API 一覧(@zeppos/device-types 4.0.0 由来)

@version 列がそのシンボルが追加された API_LEVEL。空欄は Zepp OS 1.0 / 2.0 からある基本 API。@permissionCode 列はアプリ側で app.json の permissions に宣言が必要なもの(文字盤では使えない API の目印にもなる)。

旧 API(hmSensor / hmApp / hmFS / hmBle / hmSetting / WatchFace)は 型定義に宣言が無いのでここには出ない。ここには出ない。

型定義に出てくる API_LEVEL: 2.1 / 3.0 / 3.6 / 4.0 / 4.2

モジュール 公開シンボル数 うち API_LEVEL 指定あり
@zos/alarm 17 17
@zos/app 11 5
@zos/app-access 1 1
@zos/app-service 4 5
@zos/ble 30 24
@zos/device 4 1
@zos/display 13 5
@zos/fs 20 2
@zos/i18n 1 0
@zos/interaction 29 11
@zos/notification 3 3
@zos/page 11 15
@zos/router 49 43
@zos/sensor 41 24
@zos/settings 23 6
@zos/storage 4 1
@zos/timer 2 2
@zos/transfer-file 0 0
@zos/ui 11 0
@zos/user 5 1
@zos/utils 6 2

#モジュール別

#@zos/alarm — Alarm

種別 名前 API_LEVEL 権限 説明
const REPEAT_ONCE 3.0 — Repeat once
const REPEAT_MINUTE 3.0 — Specify the repetition period as minute
const REPEAT_HOUR 3.0 — Specify the repetition period as hour
const REPEAT_DAY 3.0 — Specify the repetition period as day
const REPEAT_WEEK 3.0 — Specify the repetition period as week
const REPEAT_MONTH 3.0 — Specify the repetition period as month
const REPEAT_YEAR 3.0 — Specify the repetition period as year
const WEEK_MON 3.0 — Monday
const WEEK_TUE 3.0 — Tuesday
const WEEK_WED 3.0 — Wednesday
const WEEK_THU 3.0 — Thursday
const WEEK_FRI 3.0 — Friday
const WEEK_SAT 3.0 — Saturday
const WEEK_SUN 3.0 — Sunday
function set 3.0 device:os.alarm Support for persistent timers to wake up pages of Mini Program
function cancel 3.0 device:os.alarm Cancels the set timer, if the timer is set to persist and also cancels the persistence
function getAllAlarms 3.0 device:os.alarm Get an array of all created timers alarmId for the current Mini Program, including timers that support persistence
種別 名前 API_LEVEL 権限 説明
const SCENE_APP — — In Mini Program
const SCENE_WATCHFACE — — In watchface interface
const SCENE_SETTINGS — — In the Mini Program configuration or dial edit page
const SCENE_AOD — — In the rest screen screen
function getPackageInfo — — Get some of the fields in the Mini Program configuration app.json
function getPackageInfoById 4.0 — Get some of the fields in the Mini Program configuration app.json by app ID
function getScene — — Get the current scene where the Mini Program is running
function queryPermission 3.0 — Check the authorization status of Mini Program permissions
function requestPermission 3.0 — Dynamic permission application, when querying a dynamic permission has not been authorized, you can use this interface to apply for the relevant permission. Generally, before using the system-related functional interface (such as the interface to enable app services), do the relevant permission check and application, otherwise the functional interface will not be allowed to execute due to the permission issue
function emitCustomSystemEvent 3.0 — The Mini Program can customize the system events and can actively dispatch the custom system events
function getPerformance 4.0 — Get Mini Program performance statistics, including memory usage and loading performance metrics

#@zos/app-access — System App Access

種別 名前 API_LEVEL 権限 説明
function getSportData 3.6 data:user.hd.workout By default, the system will off the screen in one page of the Mini Program, and the system will exit the Mini Program after 10s, and enter the dial page when the watch is woken up again. If relaunch is set to true, the Mini Program will reopen and enter the corresponding page when the watch is woken up again

#@zos/app-service — App Service

種別 名前 API_LEVEL 権限 説明
function start 3.0 device:os.bg_service Start the specified App service, return the result through the callback function
function stop 3.0 device:os.bg_service Shutdown the specified backend service, called asynchronously, with the shutdown result returned via a callback function
function getAllAppServices 3.0 device:os.bg_service Get the list of running App services, used to query the service status
function exit 3.0 device:os.bg_service Called in The App Service, it will exit the service and will not affect the foreground page

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
start.Option.reload property 4.0 Whether to persist and automatically restart following system running state changes. System state changes include: system restart, power saving mode entry/exit, system language changes, Mini Program updates, etc.

#@zos/ble — BLE

種別 名前 API_LEVEL 権限 説明
function mstStartScan 3.0 — Scan and discover Bluetooth peripherals, which can be filtered according to filter conditions
function mstStopScan 3.0 — Stop device scanning, used in conjunction with mstStartScan
function mstConnect 3.0 — Connecting Devices
function mstDisconnect 3.0 — Disconnecting devices
function mstPair 3.0 — Pairing with devices via connectId
function mstGetConnIdByRemoteAddr 3.0 — Look up the connection Id based on the Peripheral MAC address
function mstBuildProfile 3.0 — Creating a Profile connection
function mstOnPrepare 3.0 — Register the prepare operation callback function
function mstOnCharaReadComplete 3.0 — Register the read Characteristic completion callback function
function mstOnCharaValueArrived 3.0 — Register to read Characteristic data to the callback function
function mstOnCharaWriteComplete 3.0 — Register the Write Characteristic data completion callback function
function mstOnDescValueArrived 3.0 — Register the Read Descriptor data arrival callback function
function mstOnDescWriteComplete 3.0 — Register Descriptor data write completion callback function
function mstOnCharaNotification 3.0 — Register Characteristic Notification to reach the callback function
function mstOnServiceChangeBegin 3.0 — Register the Service start change callback function
function mstOnServiceChangeEnd 3.0 — Register the Service change end callback function
function mstOffAllCb 3.0 — Unregister of all registered Bluetooth-related callback functions
function mstPrepare 3.0 — prepare interface
function mstReadCharacteristic 3.0 — Read Characteristic information
function mstWriteCharacteristic 3.0 — Write Characteristic information
function mstReadDescriptor 3.0 — Write characteristic information
function mstWriteDescriptor 3.0 — Register the Characteristic notification arrival callback function
function mstDestroyProfileInstance 3.0 — Destroy Profile
function mstGetProfileInstance 3.0 — Query Profile pointer based on Profile name and connection ID
function createConnect — — Create connection
function disConnect — — Disconnect
function send — — Send message, data data to be sent, size length of data to be sent
function connectStatus — — Query connection status, true means connected, false means not connected
function addListener — — Registering connection status listening callback function
function removeListener — — Cancel connection status listening callback function

#@zos/device — Device

種別 名前 API_LEVEL 権限 説明
const SCREEN_SHAPE_SQUARE — — Square Screen
const SCREEN_SHAPE_ROUND — — Round Screen
function getDiskInfo — — Gets disk information
function getDeviceInfo — data:os.device.info Gets device information

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
getDeviceInfo.Result.uuid property 4.2 Device unique identifier, 32 bytes in length

#@zos/display — Display

種別 名前 API_LEVEL 権限 説明
function setWakeUpRelaunch — — By default, the system will off the screen in one page of the Mini Program, and the system will exit the Mini Program after 10s, and enter the dial page when the watch is woken up again. If relaunch is set to true, the Mini Program will reopen and enter the corresponding page when the watch is woken up again
function setAutoBrightness — — Set whether to turn on auto-brightness, if it is on, then the screen brightness will be controlled by the light sensor and the setBrightness will be disabled
function getAutoBrightness — — Get whether to turn on the screen auto brightness setting
function setBrightness — — Set the screen brightness of the current device. If the auto brightness setting is currently turned on, the brightness is automatically adjusted by the light sensor, calling setBrightness will not take effect at this time, you need to use setAutoBrightness to turn off the auto brightness and then set it again. Note: If you exit the current page, you need to consider whether you need to set the brightness back to the original brightness
function getBrightness — — Get the screen brightness of the current device
function setScreenOff — — Set the screen to rest
function setPageBrightTime — — Set the current page screen lighting time, this setting will follow the page destruction to do reset
function resetPageBrightTime — — Cancel the bright time set by setPageBrightTime
function pausePalmScreenOff 2.1 — Suspension of overlapping palm resting screen behavior
function resetPalmScreenOff 2.1 — Recovery of overlapping palm resting screen behavior
function pauseDropWristScreenOff 2.1 — Suspension of wrist resting behavior
function resetDropWristScreenOff 2.1 — Resume wrist drop resting behavior
function getSettings 3.0 — Get system display related information

#@zos/fs — File System

種別 名前 API_LEVEL 権限 説明
const O_RDONLY — — Flag indicating to open a file for read-only access
const O_WRONLY — — Flag indicating to open a file for write-only access
const O_RDWR — — Flag indicating to open a file for read-write access
const O_APPEND — — Flag indicating that data will be appended to the end of the file
const O_CREAT — — Flag indicating to create the file if it does not already exist
const O_EXCL — — Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists
const O_TRUNC — — Flag indicating that if the file exists and the file is opened successfully for write access, its length shall be truncated to zero
function openSync — — Open the file in the /data directory of the Mini Program synchronously and get the file handle
function openAssetsSync — — Open the file in the /assets directory of the Mini Program synchronously and get the file handle
function statSync — — Get information about the files in the /data directory of the Mini Program synchronously
function statAssetsSync — — Synchronously gets information about the files in the Mini Program /assets directory
function closeSync — — Close the file handle synchronously
function readSync — — Synchronously reads the content from the file specified by the file handle into the given ArrayBuffer.
function writeSync — — Synchronously write ArrayBuffer to the file specified by fd
function rmSync — — Synchronously delete files in the /data directory of the Mini Program
function renameSync — — Rename the files in the /data directory of the Mini Program, renaming the files from oldPath to newPath
function mkdirSync — — Synchronously create a directory in the /data directory of the Mini Program
function readdirSync — — Read the directory under the /data directory of the Mini Program synchronously
function readFileSync — — Returns the entire contents of the specified file in the /data directory of the Mini Program
function writeFileSync — — Synchronously write data to a file in the /data directory of the Mini Program, replacing the file if it already exists, or creating a new file if it doesn't

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
openSync.Option.options property 3.0 Other Options
openSync.Options.appId property 3.0 Mini Program ID, you can open the file in the /data directory of the Mini Program with the corresponding ID

#@zos/i18n — I18n

種別 名前 API_LEVEL 権限 説明
function getText — — Get the corresponding string from the internationalization resource file (.po) based on the internationalization key

#@zos/interaction — Interaction

種別 名前 API_LEVEL 権限 説明
const GESTURE_UP — — Gesture up slide
const GESTURE_DOWN — — Gesture down slide
const GESTURE_LEFT — — Gesture left slide
const GESTURE_RIGHT — — Gesture right slide
const KEY_BACK — — BACK KEY
const KEY_SELECT — — SELECT KEY
const KEY_HOME — — HOME KEY
const KEY_UP — — UP KEY
const KEY_DOWN — — SHORTCUT KEY
const KEY_SHORTCUT — — SHORTCUT KEY
const KEY_EVENT_CLICK — — Key click event
const KEY_EVENT_LONG_PRESS — — Key long-press event
const KEY_EVENT_DOUBLE_CLICK — — Key double-click event
const KEY_EVENT_PRESS — — Key press event
const KEY_EVENT_RELEASE — — Key release event
const MODAL_CONFIRM — — Modal Confirm button
const MODAL_CANCEL — — Modal Cancel button
const WRIST_MOTION_LIFT — — Wrist lift
const WRIST_MOTION_LOWER — — Wrist down
const WRIST_MOTION_FLIP — — Flip wrist movement
function showToast — — Display Message Prompt Box
function createModal — — Create Modal prompt box
function onGesture — — Listen to user gesture events, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
function offGesture — — Cancel the onGesture registration to listen for user gesture events
function onKey — — Listen to key events, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
function offKey — — Cancel the keystroke event registered by onKey.
function onDigitalCrown — — Listen to the digital crown rotation event, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
function offDigitalCrown — — Cancel the onDigitalCrown registration to listen for digital crown rotation events
function onWristMotion 3.0 — Monitoring hand movement events

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
createModal.Option.title property 3.6 Modal dialog box title, alias for content
createModal.Option.subtitle property 3.6 subtitle
createModal.Option.src property 3.6 Icon icon path
createModal.Option.text property 3.6 text content
createModal.Option.textColor property 3.6 text color
createModal.Option.textAlpha property 3.6 Text transparency, transparency [0-255], 0 is full transparency
createModal.Option.okButton property 3.6 The icon path of the confirmation button
createModal.Option.cancelButton property 3.6 Cancel button icon icon path
createModal.Option.capsuleButton property 3.6 Capsule button configuration, as a string array, click type in the returned KeyObj starting from 10
onWristMotion.Params.type property 3.6 Action type, 0 - palm covering, 3 - wrist event

#@zos/notification — Notification

種別 名前 API_LEVEL 権限 説明
function notify 3.0 device:os.notification Send notifications to the Watch Notification Center
function cancel 3.0 device:os.notification Delete the notification message identified by the specified ID in the notification center
function getAllNotifications 3.0 device:os.notification Get the notification IDs that have been sent by the current app and are still in the notification center
種別 名前 API_LEVEL 権限 説明
const SCROLL_MODE_FREE — — Free scrolling mode, system default scrolling mode
const SCROLL_MODE_SWIPER — — Swiper mode, vertical rotating map, walking lights, by configuring the height and number of individual pages can achieve the whole screen scrolling effect
const SCROLL_MODE_SWIPER_HORIZONTAL 2.1 — Swiper mode, horizontal rotating map, walking lights, by configuring the width and number of individual pages can achieve the whole screen scrolling effect
const SCROLL_ANIMATION_SMOOTH — — Scroll smoothly to the corresponding position
const SCROLL_ANIMATION_NONE — — No animation, scroll directly to the corresponding position
function scrollTo — — Scroll the page to the specified position
function getScrollTop — — Get the vertical coordinate of the current scroll position of the page
function setScrollMode — — Set the scroll mode of the page
function setScrollLock — — Set the current page scrolling position to be locked, i.e. the screen position will not change with the gesture swipe. After calling this API to perform the unlock operation, the page scrolling mode will be set to free scrolling mode
function swipeToIndex — — Scrolls the page to the Swiper's target item, only if the current page scroll mode is SCROLL_MODE_SWIPER
function getSwiperIndex — — Get the scroll position of the current page, only if the page scroll mode is SCROLL_MODE_SWIPER or SCROLL_MODE_SWIPER_HORIZONTAL return the index of the current item (starting from 1), otherwise return undefined

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
scrollTo.Option.animConfig property 3.6 Scroll animation configuration
scrollTo.animConfig.anim_rate property 3.6 Animation curve, optional values linear, easein, easeout, easeinout refer to https://easings.net/
scrollTo.animConfig.anim_duration property 3.6 Animation duration, in milliseconds
scrollTo.animConfig.anim_fps property 3.6 Animation frame rate
scrollTo.animConfig.anim_complete_func property 3.6 End of animation callback function
setScrollMode.Options.width property 2.1 Specify the width of a single item in Swiper, effective only if the scroll mode is SCROLL_MODE_SWIPER_HORIZONTAL
setScrollMode.Options.modeParams property 3.0 Parameters for the scroll mode
setScrollMode.FreeModeParams.scroll_frame_func property 3.0 The callback function for each frame during scrolling
setScrollMode.FreeModeParams.scroll_complete_func property 3.0 The end of the scroll callback function
setScrollMode.FreeModeParams.bounce property 3.6 Control whether the page rebound effect is turned on. When the page content exceeds one screen, it is turned on by default. If the page content is less than one screen, it is turned off by default. This parameter needs to be passed in the build lifecycle to take effect.
setScrollMode.ScrollObj.type property 3.0 Todo
setScrollMode.ScrollObj.yoffset property 3.0 Pixel offset on the y axis
setScrollMode.SwipeModeParams.on_page property 3.0 Callback function after page flipping, pageIndex is the page index after page flipping, and the index starts from 0
setScrollMode.SwipeModeParams.crown_enable property 3.0 Whether to respond to crown events, the default response, you can use the crown to control page turning

#@zos/router — Router

種別 名前 API_LEVEL 権限 説明
const SYSTEM_APP_STATUS 3.0 — Activity
const SYSTEM_APP_HR 3.0 — Heart Rate
const SYSTEM_APP_SPORT 3.0 — Workout
const SYSTEM_APP_WEATHER 3.0 — Weather
const SYSTEM_APP_ALARM 3.0 — Alarm
const SYSTEM_APP_CAMERA 3.0 — Camera Remote
const SYSTEM_APP_MUSIC 3.0 — Music
const SYSTEM_APP_STOPWATCH 3.0 — Stopwatch
const SYSTEM_APP_COUNTDOWN 3.0 — Timer
const SYSTEM_APP_FINE_PHONE 3.0 — Find My Phone
const SYSTEM_APP_CARD 3.0 — Cards
const SYSTEM_APP_ALIPAY 3.0 — Alipay
const SYSTEM_APP_SETTING 3.0 — Settings
const SYSTEM_APP_SPORT_HISTORY 3.0 — Workout History
const SYSTEM_APP_COMPASS 3.0 — Compass
const SYSTEM_APP_PAI 3.0 — PAI
const SYSTEM_APP_WORLD_CLOCK 3.0 — World Clock
const SYSTEM_APP_PRESSURE 3.0 — Stress
const SYSTEM_APP_MENSTRUAL 3.0 — Cycle Tracking
const SYSTEM_APP_SPORT_STATUS 3.0 — Workout Status
const SYSTEM_APP_CALENDAR 3.0 — Calendar
const SYSTEM_APP_SLEEP 3.0 — Sleep
const SYSTEM_APP_SPO2 3.0 — Blood Oxygen
const SYSTEM_APP_PHONE 3.0 — Phone
const SYSTEM_APP_NETEASE_MUSIC 3.0 — NetEase Music
const SYSTEM_APP_WEPAY 3.0 — Weixin Pay
const SYSTEM_APP_BREATH 3.0 — Breathe
const SYSTEM_APP_POMODORO 3.0 — Pomodoro Timer
const SYSTEM_APP_ALEAX 3.0 — Alexa
const SYSTEM_APP_THERMOMETER 3.0 — Thermometer
const SYSTEM_APP_TODO_LIST 3.0 — To Do
const SYSTEM_APP_ALTIMETER 3.0 — Barometer
const SYSTEM_APP_VOICE_MEMO 3.0 — Voice Memos
const SYSTEM_APP_SUN_AND_MOON 3.0 — Sun & Moon
const SYSTEM_APP_MEASUREMENT 3.0 — One-tap Measuring
const SYSTEM_APP_ZEPP_COACH 3.0 — Zepp Coach
const SYSTEM_APP_CLUB_CARD 3.0 — Membership Card
const SYSTEM_APP_BODY_COMPOSITION 3.0 — Body Composition
const SYSTEM_APP_READINESS 3.0 — Readiness
function launchApp — — Open Mini Program
function push — —
function replace — —
function home — —
function back — —
function exit — —
function setLaunchAppTimeout — — Register a timer to launch the Mini Program at a given time
function clearLaunchAppTimeout — — Cancel the wakeup Mini Program timer created by setLaunchAppTimeout
function checkSystemApp 3.0 — Check if the system application supports jumping
function getAppIdByName 3.6 — Fuzzy match the English name of installed Mini Programs on the device by name

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
launchApp.Option.native property 3.0 Whether to jump to the system App
setLaunchAppTimeout.Option.delay property 3.0 The time, in milliseconds that the timer should wait before the Mini Program is waked.

#@zos/sensor — Sensor

種別 名前 API_LEVEL 権限 説明
const VIBRATOR_SCENE_SHORT_LIGHT — — Light vibration intensity and short time (20ms)
const VIBRATOR_SCENE_SHORT_MIDDLE — — Medium vibration intensity, short time (20ms)
const VIBRATOR_SCENE_SHORT_STRONG — — High vibration intensity and short time (20ms)
const VIBRATOR_SCENE_DURATION — — High vibration intensity, lasting 600ms
const VIBRATOR_SCENE_DURATION_LONG — — High vibration intensity, lasting 1000ms
const VIBRATOR_SCENE_STRONG_REMINDER — — High vibration intensity, four vibrations in 1200ms, can be used for stronger reminders
const VIBRATOR_SCENE_NOTIFICATION — — Two short, continuous vibrations, consistent with the watch message notification vibration feedback
const VIBRATOR_SCENE_CALL — — High vibration intensity, single vibration twice in 500ms, continuous vibration, need to manually stop, consistent with the watch call vibration feedback
const VIBRATOR_SCENE_TIMER — — High vibration intensity, single long vibration 500ms, continuous vibration, need to manually stop, consistent with the watch alarm clock, countdown vibration feedback
const TIME_HOUR_FORMAT_12 2.1 — 12-hour format
const TIME_HOUR_FORMAT_24 2.1 — 24-hour format
const FREQ_MODE_LOW 3.0 — Low power mode with low trigger frequency
const FREQ_MODE_NORMAL 3.0 — Normal power consumption mode, medium trigger frequency
const FREQ_MODE_HIGH 3.0 — High power consumption mode with high trigger frequency
class Time — — Time/Date Sensor
class Battery — — Battery Sensor
class Step — data:user.hd.step Step Sensor
class Calorie — data:user.hd.calorie Calorie Sensor
class HeartRate — data:user.hd.heart_rate HeartRate Sensor
class Pai — data:user.hd.pai PAI Sensor
class Distance — data:user.hd.distance Distance Sensor
class Stand — data:user.hd.stand Standing behavior Sensor
class FatBurning — data:user.hd.fat_burning FatBurning Sensor
class BloodOxygen — data:user.hd.spo2 Blood oxygen Sensor
class Stress — data:user.hd.stress Stress Sensor
class Wear — — Wearing status sensor
class Sleep — data:user.hd.sleep Sleep Sensor
class Weather ⚠️deprecated — — Weather Forecasts sensor
class Vibrator — — Vibrator
class Barometer 2.1 device:os.barometer Barometer Sensor
class Geolocation 2.1 device:os.geolocation Geolocation Sensor
class Workout 3.0 data:user.hd.workout Workout Sensor
class WorldClock 3.0 — World Clock Sensor
class Compass 3.0 device:os.compass compass
class Gyroscope 3.0 device:os.gyroscope Gyroscope. Measuring the angular velocity of the device rotating along three orthogonal axes (x, y, z), the x and y axes are parallel to the screen, the positive direction refers to the figure, the z axis is perpendicular to the device's screen, the positive direction points upward, and the direction of the rotational angular velocity is determined using the Right-hand rule. The direction of the rotation arrow in the figure is the positive direction
class Accelerometer 3.0 device:os.accelerometer accelerometer. Measure the acceleration of the device along three orthogonal axes (x, y, z). The x and y axes are parallel to the screen, with the positive direction referring to the diagram. The z-axis is perpendicular to the device's screen, with the positive direction pointing upward
class Screen 3.0 — Screen Status Sensor
class BodyTemperature 3.0 data:user.hd.body_temp Body surface temperature sensor
class SystemSounds 3.6 — System Sounds
class Buzzer 3.6 — Buzzer
function checkSensor 3.0 — Check the availability of sensors on the current device

後から追加されたフィールド / 定数:

パス 種別 API_LEVEL 説明
Vibrator.start.Action.type property 3.6 Vibration Scene Type
Vibrator.start.Action.duration property 3.6 Duration of vibration
Geolocation.onGnssChange.SatelliteSystem.gsv_data property 3.6 Single satellite data array, maximum length 32
Geolocation.onGnssChange.Satellite.id property 3.6 Satellite ID
Geolocation.onGnssChange.Satellite.elevation property 3.6 Pitch angle
Geolocation.onGnssChange.Satellite.azimuth property 3.6 Azimuth
Geolocation.onGnssChange.Satellite.snr property 3.6 Signal-to-noise ratio

#@zos/settings — System Settings

種別 名前 API_LEVEL 権限 説明
const DATE_FORMAT_YMD — — year-month-day
const DATE_FORMAT_DMY — — day-month-year
const DATE_FORMAT_MDY — — month-day-year
const TIME_FORMAT_12 2.1 — 12-hour format
const TIME_FORMAT_24 2.1 — 24-hour format
const DISTANCE_UNIT_METRIC — — metric system
const DISTANCE_UNIT_IMPERIAL — — imperial system
const WEIGHT_UNIT_KILOGRAM — — Kilogram
const WEIGHT_UNIT_JIN — — Jin
const WEIGHT_UNIT_POUND — — Pound
const WEIGHT_UNIT_STONE — — Stone
const TEMPERATURE_UNIT_CENTIGRADE — — Celsius temperature
const TEMPERATURE_UNIT_FAHRENHEIT — — Fahrenheit temperature
function getLanguage — — Get the current system language setting
function getDateFormat — — Get the current system date format
function getTimeFormat 2.1 — Get the current system time format, 12-hour format or 24-hour format
function getDistanceUnit — — Returns whether the current distance unit is metric or imperial. This method is to get the units set by the user, not to represent the units of the data, the data units refer to the interface description of the corresponding data
function getWeightUnit — — Gets the weight unit set by the user
function getWeightTarget — — Get the weight target set by the user
function getSleepTarget — — Get the sleep target set by the user
function getTemperatureUnit 2.1 — Get the temperature units set by the user
function getSystemInfo 2.1 — Get system related information
function getSystemMode 3.0 — Get the system mode setting information

#@zos/storage — Storage

種別 名前 API_LEVEL 権限 説明
const localStorage — —
class LocalStorage 3.0 device:os.local_storage Locally stored key-value pairs, data cleared after Mini Program uninstallation
const sessionStorage — —
class SessionStorage — — Key-value pairs are stored and data is cleared after exiting the Mini Program

#@zos/timer — timer

種別 名前 API_LEVEL 権限 説明
function createSysTimer 4.0 — A system-level timer that can be registered in device app services and runs regardless of watch screen state
function stopTimer 4.0 — Stop the timer created by createSysTimer method

#@zos/transfer-file — Transfer File

(型定義に公開シンボルの宣言なし)

#@zos/ui

種別 名前 API_LEVEL 権限 説明
const createWidget — —
const widget — —
const align — —
const prop — —
const text_style — —
const event — —
const arc_type — —
const data_type — —
const sport_data — —
const edit_widget_group_type — —
const VARIANT_BUTTON — —

#@zos/user — User

種別 名前 API_LEVEL 権限 説明
const GENDER_MALE — — Male
const GENDER_FEMALE — — Female
const GENDER_UNSPECIFIED — — User not specified
function getProfile — data:user.info Get user information
function addHealthData 3.0 data:user.health Set user health data information

#@zos/utils — Utils

種別 名前 API_LEVEL 権限 説明
function px — — Pixel scaling calculation. The designWidth of each model in the targets object in the app.json is used as the base.
function assets — — Used to handle resource file paths, splice basePath. and can pass in parameters for rtl path conversion of images, for RTL adaptation of Mini Program
const log — —
class EventBus — — EventBus is a utility class that provides event publishing/subscribing, an implementation of the publish-subscribe pattern
function stringToBuffer 4.0 — Convert string type to ArrayBuffer type
function bufferToString 4.0 — Convert ArrayBuffer type to string type

#hmUI / @zos/ui の列挙型

@zos/ui が export する widget / prop / align / text_style / event の 実体。グローバルの hmUI.*(文字盤で使う方)も同じ値を指す。

#hmUI.widget.* (42) — ウィジェット種別(hmUI.createWidget の第 1 引数)

名前 API_LEVEL 説明
GROUP — GROUP group component is used to group a series of components together for unified widget of show/hide, registering events, etc
IMG — The image widget is used to display images and supports image rotation
IMG_GROUP — Image group widget is used to show an image carousel, mainly for watchface photo rotation
TEXT — Text component for displaying text. Support setting text size, color and alignment
ARC — Arc widget to display arc progress. Support setting line width, color, start and end angle
FILL_RECT — The Fill Rectangle widget is used to draw a solid color rectangular area
STROKE_RECT — The stroked rectangle widget adds a stroke on the basis of the filled rectangle component
TEXT_IMG —
ARC_PROGRESS —
IMG_PROGRESS —
IMG_ARC_PROGRESS —
IMG_LEVEL —
IMG_ANIM — Play the pre-given image at the set frame rate to create an animation effect
BUTTON — The button widget supports setting images and colors for normal and pressed states
KEYBOARD — Numeric keyboard widget supporting key add, delete and parameter updates
LINE_PROGRESS — Horizontal progress bar
BUTTON_GROUP — Button group container used to manage variant buttons
VARIANT_BUTTON — Variant button
CIRCLE — Draws a circle with support for color, transparency, and other properties
DIALOG — Dialog popup consists of a piece of text and two buttons. The popup box disappears when the buttons are clicked
SCROLL_LIST — Create a sliding list area, which can be filled with pictures and text
SLIDE_SWITCH — Used to switch between open and closed states
CYCLE_LIST — Create a list that scrolls in a loop, which can be populated with images
CYCLE_IMAGE_TEXT_LIST — Create a list that can be scrolled in a loop, filled with images and text
IMG_POINTER —
CHECKBOX_GROUP — Used to select a single result among multiple options. Each individual option needs to be created using STATE_BUTTON
STATE_BUTTON —
RADIO_GROUP — Used to select a single result among multiple options. Each individual option needs to be created using STATE_BUTTON
WIDGET_DELEGATE —
HISTOGRAM — Draws a histogram
PICK_DATE — Time picker widget, providing user choice
TIME_PICKER — Time picker, supporting time and date selection
SPORT_DATA — Sport data picker widget, providing user choice
VIEW_CONTAINER — Create a layer, which can add any number of child widgets
GROUP_VIEW — Group view container
VIRTUAL_CONTAINER — Create a layout virtual container, which can add any number of child widgets
WIDGET_PICKER — Create a data picker widget, providing user choice
QRCODE — Create a QR code
POLYLINE — Create a polyline
CANVAS — Create a canvas
PAGE_INDICATOR — Create a page indicator
PAGE_SCROLLBAR — Create a page scrollbar

#hmUI.prop.* (29) — setProperty / getProperty に渡すプロパティ

名前 API_LEVEL 説明
MORE —
X — x coordinate
Y — y coordinate
W — Width
H — Height
POS_X —
POS_Y —
ANGLE —
CENTER_X —
CENTER_Y —
SRC — Resource Path
TEXT — Text Content
TEXT_SIZE — Text size
COLOR —
START_ANGLE —
END_ANGLE —
LINE_WIDTH —
LINE_PROGRESS_START_X —
LINE_PROGRESS_START_Y —
LINE_PROGRESS_END_X —
LINE_PROGRESS_END_Y —
LINE_PROGRESS_PROGRESS —
LINE_PROGRESS_SRC_BG —
LINE_PROGRESS_SRC_PROGRESS —
LINE_PROGRESS_SRC_INDICATOR —
WORD_WRAP —
ID —
DATASET —
VISIBLE —

#hmUI.align.* (6) — align_h / align_v

名前 API_LEVEL 説明
TOP — Vertical axis-top
BOTTOM — Vertical axis-bottommost
LEFT — Horizontal axis-left aligned
RIGHT — Horizontal axis-align right
CENTER_H — Horizontal axis-centered
CENTER_V — Vertical axis_centered

#hmUI.text_style.* (4) — text_style(文字のあふれ方)

名前 API_LEVEL 説明
WRAP —
CHAR_WRAP —
ELLIPSIS — Single line overflow character display...
NONE — Keep scrolling

#hmUI.event.* (6) — addEventListener のイベント種別

名前 API_LEVEL 説明
CLICK_UP — Lift up
CLICK_DOWN — Press
MOVE_IN — Move in
MOVE_OUT — Move out
MOVE — Slide
SELECT — One full click (including press and lift)

#hmUI.data_type.* (7) — IMG_PROGRESS 等のデータ種別

名前 API_LEVEL 説明
BATTERY —
CAL —
DISTANCE —
HEART —
SLEEP —
SPORT_ALTITUDE —
TRACK —

#hmUI.arc_type.* (2)

FILL / LINE

#hmUI.variant_button_type.* (10)

SUS_TEXT / SUS_ICON / SUS_SIDE_BY_SIDE / SUS_SEL_AND_BACK / CPS_TEXT / CPS_MUL_TEXT / MUL_TEXT / CPS_IMAGE / ROUND / IMAGE

#hmUI.edit_widget_group_type.* (1)

SPORTS

#hmUI.sport_data_type.* (190)

DURATION_NET / DURATION_CUR_SECTION / DURATION_PREV_SECTION / DURATION_AVG_SECTION / DURATION_CUR_GROUP / DISTANCE_TOTAL / DISTANCE_CUR_SECTION / DISTANCE_PREV_SECTION / COUNT_TOTAL / COUNT_CUR_ROPE / COUNT_BROKEN_ROPE / COUNT_TOTAL_BOAT / COUNT_CUR_BOAT / COUNT_CUR_FITNESS / GLIDE_COUNT / GLIDE_TOTAL_DISTANCE / GLIDE_CUR_DISTANCE / GLIDE_TOTAL_ALTITUDE / GLIDE_CUR_ALTITUDE / CLIMB_UP_FLOORS / CLIMB_UP_CUR_FLOORS / CLIMB_UP_PREV_FLOORS / CLIMB_DOWN_FLOORS / CLIMB_DOWN_CUR_FLOORS / CLIMB_DOWN_PREV_FLOORS / CLIMB_UP_FLOORS_IN_MIN / CLIMB_UP_TOTAL_ALTITUDE / CLIMB_UP_CUR_ALTITUDE / CLIMB_UP_PREV_ALTITUDE / CLIMB_DOWN_ALTITUDE_TOTAL / CLIMB_DOWN_CUR_ALTITUDE / CLIMB_DOWN_PREV_ALTITUDE / SWIM_TOTAL_LAPS / SWIM_CUR_LAPS / SWIM_PREV_LAPS / SWIM_TOTAL_STROKE_CNT / SWIM_CUR_STROKE_CNT / SWIM_PREV_STROKE_CNT / SWIM_AVG_STROKE_DISTANCE / SWIM_AVG_SECTION_STROKE_CNT / SWIM_STROKE_SPEED / SWIM_CUR_STROKE_SPEED / SWIM_PREV_STROKE_SPEED / SWIM_AVG_STROKE_SPEED / SWIM_AVG_SWOLF / SWIM_CUR_SWOLF / SWIM_PREV_SWOLF / PACE / PACE_AVG / PACE_CUR_AVG / PACE_PREV_AVG / STRIDE_FREQ / STRIDE_AVG_FREQ / STRIDE_CUR_FREQ / STRIDE_PREV_FREQ / STRIDE / STRIDE_AVG / STRIDE_CUR / STRIDE_PREV / STRIDE_COUNT / SPEED / SPEED_AVG / SPEED_AVG_GLIDE / SPEED_PREV_GLIDE / SPEED_CUR_SECTION / SPEED_PREV_SECTION / SPEED_MAX / SPEED_VERTICAL / ALTITUDE / ALTITUDE_MAX / ALTITUDE_MIN / ALTITUDE_AVG / SLOPE_TOTAL_RISING_DISTANCE / SLOPE_CUR_RISING_DISTANCE / SLOPE_PREV_RISING_DISTANCE / ALTITUDE_TOTAL_UP / ALTITUDE_CUR_UP / ALTITUDE_PREV_UP / ALTITUDE_TOTAL_DOWN / ALTITUDE_CUR_DOWN / ALTITUDE_PREV_DOWN / SLOPE / SLOPE_AVG / SLOPE_CUR / SLOPE_PREV / SLOPE_GLIDE / SLOPE_AVG_GLIDE / SLOPE_CUR_GLIDE / SLOPE_PREV_GLIDE / BRANDISH_TOTAL_CNT / BRANDISH_POSITIVE_CNT / BRANDISH_NEGATIVE_CNT / BRANDISH_SERVE_CNT / CONSUME / CONSUME_CUR / BOATING_FREQ / BOATING_AVG_FREQ / BOATING_CUR_FREQ / BOATING_PULL / BOATING_PUSH / FREQ / FREQ_AVG / FREQ_CUR / GOLF_SPEED / GOLF_ANGLE / GOLF_UP_TIME / GOLF_DOWN_TIME / GOLF_BEAT / GOLF_SWING_COUNTER_GROUP / GOLF_SWING_COUNTER / GOLF_AVG_SCORE / GOLF_SCORE / HR / HR_AVG / HR_CUR_AVG / HR_INTERVAL / HR_MAX_PERCENT / HR_RESERVED_PERCENT / HR_AVG_MAX_PERCENT / HR_AVG_RESERVED_PERCENT / HR_CUR_SECTION / HR_CUR_MAX_PERCENT / HR_CUR_RESERVED_PERCENT / HR_PREV_SECTION / HR_PREV_MAX_PERCENT / HR_PREV_RESERED_PERCENT / PRESSURE / PRESSURE_AVG / PRESSURE_CUR / PRESSURE_PREV / TEMP / TEMP_MAX / TEMP_MIN / OTHER_SECTION_ORDER / OTHER_AEROBIC_TE / OTHER_ANAEROBIC_TE / OTHER_TRAIN_LOAD / OTHER_CUR_TIME / OTHER_SUNRISE_TIME / OTHER_SUNSET_TIME / OTHER_BORAMETER / OTHER_ACTIONNAME / CHART_HR / CHART_SPEED / CHART_STROKE_FREP / CHART_TE / CHART_STROKE_SPEED / CHART_PACE / CHART_ALTITUDE / CHART_FREQ / DEVICE_POWER / DEVICE_POWER_WEIGHT / DEVICE_WORK / DEVICE_AVG_POWER / DEVICE_MAX_POWER / DEVICE_3S_AVG_POWER / DEVICE_10S_AVG_POWER / DEVICE_30S_AVG_POWER / DEVICE_LAP_AVG_POWER / DEVICE_PREV_AVG_POWER / DEVICE_CADENCE / DEVICE_FAST_CADENCE / DEVICE_AVG_CADENCE / DEVICE_LAP_AVG_CADENCE / DEVICE_PREV_AVG_CADENCE / DURATION_GLIDE / DURATION_TOTAL_CLIMB / GLIDE_PREV_DISTANCE / GLIDE_PREV_ALTITUDE / SPEED_MAX_GLIDE / SLOPE_GLIDE_MAX / SLOPE_GLIDE_AVG / GLIDE_ANGLE_MAX / GLIDE_ANGLE_AVG / DURATION_SURFACE / DURATION_CUR_DIVING / DURATION_PREV_DIVING / COUNT_DIVING / COUNT_CAUGHT / SPEED_DIVING / DEPTH / DEPTH_AVG / DEPTH_MAX / DEPTH_MAX_PREV / HEIGHT / DESENT_SPEED / DESENT_SPEED_MAX / DESENT_SPEED_AVG / SKYDIVING_HEIGHT / COUNT_CONTINUOUS_ROPE

#hmUI のトップレベル関数

@zos/ui が export していないものも含む、グローバル hmUI のメソッド宣言 (公式ドキュメントに項目が無いものも多い)。型定義そのままの引用。

#IHmUIFunction

createWidget(widgetType: HmUIWidgetType, options: HmUIWidgetOptions): IHmUIWidget;
deleteWidget(widget: IHmUIWidget): boolean;
redraw(): void;

#IHmUIExtensionFunction

getTextLayout: IHmUIGetTextLayout;
updateLayout: (obj: IHmUIWidget) => void;
pixel: (express: string, refer_width?: boolean) => number | undefined;
createKeyboard: (obj: {
      inputType?: number,
      text: string,
      onComplete: (ele: IHmUIWidget, result: { data: string }) => void
      onCancel?: (ele: IHmUIWidget, result: { data: string }) => void
    }) => void;
deleteKeyboard: () => void;
getRtlLayout(): boolean;
relayoutRtl(): void;
showToast(options: { text: string }): void;
createDialog(options: {
      title: string
      show: boolean
      auto_hide?: boolean
      click_linster: (key: number) => void
      click_listener: (key: number) => void
    }): IHmUIDialogType;
setScrollView(enable: boolean, pageHeight?: number, pageCount?: number, isVertical?: boolean, opts?: Record<string, unknown>): boolean;
setLayerScrolling(enable: boolean, opts?: Record<string, unknown>): boolean;
scrollToPage(index: number, animation: boolean): void;
getScrollCurrentPage(): undefined | number;
setStatusBarVisible(visible: boolean): void;
updateStatusBarTitle(title: string): void;
getSysFontSize(size: number): number;
sp(size: number | string): number;
getImageInfo(p: string): { width: number, height: number };
setAppWidgetSize(options: {
      h: number
    }): void;
getAppWidgetSize(): { w: number, h: number, margin: number, radius: number };
openInspector(): IInspector;

#グローバル(import 不要)

種別 名前 API_LEVEL 説明
function App — Register the Mini Program, specifying the Mini Program's lifecycle callbacks, etc. App() must be called in app.js, and can only be called once
function getApp — Get the app instance object
function Page — Register a page in the Mini Program, specify the lifecycle callback for the current page, etc. Each page file must call the Page() constructor only once
function SecondaryWidget — Register SecondaryWidget, specify the lifecycle callback for the current SecondaryWidget, etc. Each SecondaryWidget file must call the SecondaryWidget() constructor only once
function AppWidget — Register AppWidget, specify the lifecycle callback for the current AppWidget, etc. Each AppWidget file must call the AppWidget() constructor only once
function DataWidget 3.6 Register DataWidget, specify the lifecycle callback for the current DataWidget, etc. Each DataWidget file must call the DataWidget() constructor only once
function AppService 3.0 Register an App Service in the Mini Program, specify the lifecycle callback for the current App Service, etc. Each App Service file must call the AppService() constructor only once
function getCurrentPage — Get the page instance object
interface console — Console Print Log
function setTimeout — Set a timer and execute the registered callback function after the timer expires
function clearTimeout — Cancel the timer registered by setTimeout
function setInterval — Repeatedly call a function with a fixed time interval between each call
function clearInterval — Cancel the timer registered by setInterval
class Buffer —