Skip to content

FeatureManager

Zhexuan Liu edited this page Jun 21, 2018 · 1 revision

FeatureManager

本文档介绍了 envoy 暴露出来的 FeatureManager 的基类中已经注册和监听好的事件,以及每个事件的意义. 为了方便书写,具体的接口都采用英语撰写。

如何调用

这里暴露出来的所有接口都是异步的,所以在 JS 语法中使用 await 来调用。调用时依次填充该文档提及的参数即可。

如:

const key = "test-key";
const deviceId = "test-id";
const items = await featureManager.getItemFromMeshStorage(key, deviceId);

上面示例中即通过相关接口获取到某台设备中 mesh storage 的内容

Common parameter Explanation

Explaining common parameters to avoid duplicated docs

  • deviceId: Id of device we are requesting against for locations. Usually this comes from the onStart callback and is the iotDeviceId returned from data. For more detail, please check the Start section in this doc

getCurrentLocation

Gets current location of a specific device

Params

  • deviceId: explained in Common Parameter Explanation section

Return a location object like this:

{
	coordinate: {
		lat: number,
		lng: number,
	},
	altitude: number,
}

getHomepoint

Gets homepoint location of a specific device

Params

  • deviceId: explained in Common Parameter Explanation section

Return a location object like this:

{
	coordinate: {
		lat: number,
		lng: number,
	},
	altitude: number,
}

getHotpointAltitudeRange

Gets altitude range for executing a hotpoint. Each device, when trying to perform a hotpoint operation, has limited altitude based on its current location, and this needs to be queried by featureManager.

Params

  • deviceId: explained in Common Parameter Explanation section

Return an interval object like this

{
	min: number,
	max: number,
}

getHotpointMaxAngularVelocityOfRadius

Gets the max angular velocity for performing a hotpoint operation with certain radius

Params

  • radius: radius of the hotpoint
  • deviceId: explained in Common Parameter Explanation section

Returns

Returns a number representing the max angular velocity

getHotpointRadiusRange

Gets radius range for executing a hotpoint operation on a device

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A range interval in following format

{
	min: number,
	max: number,
}

getExposureModeRange

Returns exposure mode range on a specific aircraft

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A range interval in following format

{
	min: number,
	max: number,
}

setExposureMode

Sets exposure mode on a specific aircraft. The exposure mode set should be in the result returned by getExposureModeRange

Params

  • value: expected value to be set for exposure mode
  • deviceId: explained in Common Parameter Explanation section

Returns

true if succeeded

getShutterSpeed

Gets shutter speed on a given device

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A number representing the current shutter speed on a device. Null if deviceId is invalid

setShutterSpeed

Sets shutter speed on a given device

Params

  • value: expected value to be set for shutter speed on a given device
  • deviceId: explained in Common Parameter Explanation section

Returns

true if succeeded

getShutterSpeedRange

Gets range of shutterspeed supported on a given device

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A range object in following format

{
	min: number,
	max: number,
}

getIsAdjustableApertureSupported

Gets if Adjustable Aperture is supported on a given device

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A boolean value, true if supported

setAperture

Sets aperture value on a given device

Params

  • value: expected value to be set for aperture on a given device
  • deviceId: explained in Common Parameter Explanation section

Returns

true if succeeded

getApertureRange

Gets range of aperture supported on a given device

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

A range object in following format

{
	min: number,
	max: number,
}

initCamera

Inits camera on a given device by setting its exposureMode to auto

Params

  • deviceId: explained in Common Parameter Explanation section

Returns

N/A

execute

Execute a feature on a given device

Params

  • featureData: feature data object outlining the feature to be executed, one could referred to the JS API doc for various supported feature data format
  • uuid: uuid of device; usually this comes from the onStart callback and is the uuid returned from data. For more detail, please check the Start section in this doc
  • toDeviceId: id of device to perform the feature; usually this comes from the onStart callback and is the iotDeviceId returned from data. For more detail, please check the Start section in this doc

Returns

N/A

deleteItemFromMeshStorage

Deletes an item from mesh storage

Params

  • key: key of the item to be delted
  • deviceId: explained in Common Parameter Explanation section

Returns

N/A

getItemFromMeshStorage

Gets an item from mesh storage

Params

  • key: key of the item to be retrieved
  • deviceId: explained in Common Parameter Explanation section

Returns

The retrieved item

setItemInMeshStorage

Sets an item in mesh storage

Params

  • key: key of the item to be set
  • item: actual item to be set
  • deviceId: explained in Common Parameter Explanation section

Returns

N/A

Clone this wiki locally