Skip to content

03 基础模块

santcool edited this page Jul 2, 2020 · 5 revisions

MHPluginSDK模块

新版本根据不同功能分类至不同模块

常量

userId

Service.account.ID

userName

Service.account.nickName

avatarURL AL-[122,)

Service.account.avatarURL

ownerId

Device.owner.ID

deviceId

Device.deviceID

deviceModel

Device.model

deviceExtra AL-[109,)

Device.extra

pageName AL-[110,)

废弃,可参考Package.Entrance

apiLevel

Host.apiLevel

basePath

废弃, 使用require直接引用文件

devMode

Host.isDebug

extraInfo

Package.entryInfo

systemInfo

Host.systemInfo

isVoiceDevice

Device.isVoiceDevice

viewWillAppear AL-[115,)

Events.packageViewWillAppear

deviceCancelAuthorization AL-[130,)

Event.packageAuthorizationCancel

uriNaviBackButtonImage

导航栏更新 参考迁移手册

uriNaviMoreButtonImage

导航栏更新 参考迁移手册

deviceStatusUpdatedEventName

Events.deviceReceivedMessages

onReceivingForegroundPushEventName

废弃

方法

sendEvent(eventName, body)

使用js原生emmit

registerDeviceStatusProps(propArr)

Device.getDeviceWifi().subscribeMessages

callMethod(method, params, extrainfo, callback)

Device.getDeviceWifi().callMethod

callMethodForceWay(method, params, extrainfo, way, callback) AL-[109,)

callMethodFromCloud or callMethod

localPingWithCallback(callback) AL-[109,)

Device.getDeviceWifi().localPing

callSmartHomeAPI(api, params, callback)

废弃, 功能查询Service.smarthome 中提供的

fetchUserInfo(uids, callback)AL-[125,)

Service.smarthome.getUserInfo

updateDeviceInfoCallback(callback) AL-[107,)

Device.getDeviceWifi().loadPropertiesFromCloud

getDevicePropertyFromMemCache(keys, callback)

Device.getDeviceWifi().loadProperties

setDevicePropertyToMemCache(kvPairs)

废弃

getDevicePropertyFromSrvCache(keys, callback) AL-[108,)

Service.smarthome.batchGetDeviceDatas()

getUTCFromServer(callback) AL-[125,)

Service.getUTCFromServer

openAddDeviceGroupPage

Host.ui.openAddDeviceGroupPage

openEditDeviceGroupPage(dids) AL-[120,)

Host.ui.openEditDeviceGroupPage

openTimerSettingPage(onMethod, onParam, offMethod, offParam) AL-[101,)

Host.ui.openTimerSettingPage

openCMTimerSettingPage(onMethod, onParam, offMethod, offParam, plugInterface) AL-[122,)

废弃

openTimerSettingPageWithVariousTypeParams(onMethod, onParam, offMethod, offParam) AL-[101,)

Host.ui.openTimerSettingPageWithVariousTypeParams

openDeviceUpgradePage()

Host.ui.openDeviceUpgradePage

setFirmwareUpdateErrDic(message) AL-[136,)

Device.getDeviceWifi().setFirmwareUpdateErrDic

getAvailableFirmwareForDids(dids, callback) AL-[139,)

Service.smarthome.getAvailableFirmwareForDids

startUpgradingFirmwareWithDid(did, callback) AL-[139,)

Device.getDeviceWifi.startUpgradingFirmware

closeCurrentPage()

Package.exit

openDeleteDevice() AL-[107,)

Host.ui.openDeleteDevice

openDeleteDeviceWithCustomMessage(message) AL-[126,)

Host.ui.openDeleteDevice

showFinishTips(content)

废弃,使用dialog

showFailTips(content)

废弃,使用dialog

showLoadingTips(content)

废弃,使用dialog

dismissTips()

废弃,使用dialog

showBLESwitchGuide() AL-[128,)

废弃

dismissBLESwitchGuide() AL-[128,)

废弃

openShareListBar(title, description, path, url)

Host.ui.openShareListBar

shareToWeChatSession(title, description, path, url)

废弃

shareToWeChatMoment(title, description, path, url)

废弃

openShareDevicePage()

Host.ui.openShareDevicePage

shareToWB(title, description, path, url)

废弃

shareToML(title, description, path, url)

废弃

onShare AL-[125,) 

废弃,请使用Host.file截图后分享

openPrivacyLicense AL-[129,) 

Host.ui.openPrivacyLicense

privacyAndProtocolReview AL-[133,) 

Host.ui.privacyAndProtocolReview

saveInfo(info)

Host.storage.saveInfo

loadInfoCallback(callback)

废弃

loadCurrentPlaceMarkCallback(callback)

Host.local.getlocation

loadDeviceCurrentPlaceMarkCallback(callback)

Host.local.getlocation

addRecord(type, value, extra) 已弃用

Service.smarthome.reportLog

finishCustomSceneSetupWithTrigger(trigger) AL-[107,)

Package.exitInfo

finishCustomSceneSetupWithAction(action) AL-[107,)

Package.exitInfo

finishCustomSceneSetup(payload) AL-[100,106](deprecated)

onFinishing(devices, model, callback) AL-[110,)

废弃

openDevice(did, model, callback) AL-[110,)

Host.ui.openDevice

applyForDeviceIDAndToken(model, mac,callback) AL-[110,)

Service.smarthome.applyForDeviceIDAndToken

bindDevice(model, mac, did, token, name, passwd, callback) AL-[110,)

废弃

getDevicesWithModel(model, callback) AL-[112,)

Host.ui.getDevicesWithModel

callSpecMethod(method,params,callback) pre_release

参考spec https://miecosystem.github.io/miot-plugin-sdk/module-miot_service_spec.html

firmwareNotCheckUpdate(notCheckUpdateFlag, callback) AL-[116,)

Device.getDeviceWifi().setFirmwareNotCheckUpdate

getCurrentCountryInfoCallback(callback) AL-[117,)

Service.getServerName

openPageWithClassName(className) AL-[116,)

Host.ui.openPageWithClassName

getMiWatchConfigWithCallback(callback) AL-[119,)

Service.smarthome.getMiWatchConfig

openRoomManagementPage AL-[119,)

Host.ui.openRoomManagementPage

openIftttAutoPage AL-[119,)

Host.ui.openIftttAutoPage

openNewMorePage AL-[119,)

Host.ui.openNewMorePage

openAddToDesktopPage AL-[119,)

Host.ui.openAddToDesktopPage

actualIconUrlForModel(model,callback) AL-[119,)

废弃

getUserConfigs(componentId,keys,callback) AL-[121,)

Service.storage.getUserConfigs

setUserConfigs(componentId,data,callback) AL-[121,)

Service.storage.setUserConfigs

getSystemTimezoneNameWithCallback AL-[122,)

Host.local.timezone

openNewSettingPage (废弃, 请使用Demo 工程中提供的MHSetting页面)

openFeedbackInput

Host.ui.openFeedbackInput

openVoiceCtrlDeviceAuthPage AL-[131,)

Host.ui.openVoiceCtrlDeviceAuthPage

getUserDeviceData 获取设备上报的属性和事件历史记录

Service.smarthome.getDeviceData

addCustomSettingItemWithTitle

废弃

shareSecureKey(did,shareUid,status,activeTime,expireTime,week,readonly,callback) AL-[125,)

Service.security.shareSecureKey

updateSecureKey(did,keyId,status,activeTime,expireTime,week,callback)AL-[125,)

Service.security.updateSecureKey

deleteSecureKey(did,keyId,callback)AL-[125,)

Service.security.deleteSecureKey

getSecureKey(did,callback)AL-[125,)

Service.security.getSecureKey

keepScreenNotLock(flag) AL-[112,)

Host.ui.keepScreenNotLock

*getConnectedWifi(callBack) AL-[138,)

Host.getWifiInfo

getServiceTokenWithSid AL-[138,)

Service.getServiceTokenWithSid

订阅

订阅设备状态的更新

Device.getDeviceWifi().subscribeMessages

订阅APNS推送

不支持

Clone this wiki locally