add msdp js api Signed-off-by:li-bo-boblove<boblove.libo@huawei.com>

Signed-off-by: li-bo-boblove <boblove.libo@huawei.com>
This commit is contained in:
li-bo-boblove 2022-08-05 15:07:35 +08:00
parent fbee6828b5
commit 8692405708
6 changed files with 67 additions and 1148 deletions

View File

@ -13,200 +13,107 @@
* limitations under the License.
*/
import { AsyncCallback } from "./basic";
import { Callback } from "./basic";
/**
* Subscribe to user device status notifications
* Declares a namespace that provides APIs to report the device status.
*
* @since 9
* @syscap SystemCapability.Msdp.DeviceStatus
* @import import sensor from '@ohos.DeviceStatus'
* @permission N/A
* @import import DeviceStatus from '@ohos.DeviceStatus'
*/
declare namespace DeviceStatus {
declare namespace deviceStatus {
/**
* Behavior-aware data
* Declares a response interface to receive the device status.
*
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
*/
export interface ActivityResponse {
eventType: EventType
interface ActivityResponse {
state: ActivityState;
}
/**
* Absolutely static data
* Declares the device status type.
*
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
*/
export interface StillResponse extends ActivityResponse {}
type ActivityType = 'still' | 'relativeStill';
/**
* Relatively static data
* Enumerates the device status events.
*
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
*/
export interface RelativeStillResponse extends ActivityResponse {}
enum ActivityEvent {
/**
* Vertically positioned data
* @syscap SystemCapability.Msdp.DeviceStatus
* Event indicating entering device status.
*/
export interface VerticalPositionResponse extends ActivityResponse {}
/**
* Horizontal position of the data
* @syscap SystemCapability.Msdp.DeviceStatus
*/
export interface HorizontalPositionResponse extends ActivityResponse {}
/**
* Behavior recognition type
* @syscap SystemCapability.Msdp.DeviceStatus
*/
export enum ActivityType {
TYPE_STILL = "still",
TYPE_RELATIVE_STILL = "relativeStill",
TYPE_VERTICAL_POSITION = "verticalPosition",
TYPE_HORIZONTAL_POSITION = "horizontalPosition"
}
/**
* The event type
* @syscap SystemCapability.Msdp.DeviceStatus
*/
export enum EventType {
ENTER = 1,
/**
* Event indicating exiting device status.
*/
EXIT = 2,
/**
* Event indicating entering and exiting device status.
*/
ENTER_EXIT = 3
}
/**
* Subscriptions are absolutely static
* Declares a response interface to receive the device status.
*
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
* @param type Subscriptions are absolutely static, {@code type: ActivityType.TYPE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: ActivityType.TYPE_STILL, eventType: EventType, reportLatencyNs: number, callback: AsyncCallback<StillResponse>): void;
enum ActivityState {
/**
* Entering device status.
*/
ENTER = 1,
/**
* Subscriptions are relatively static
*
* @since 9
* @param type Subscriptions are relatively static, {@code type: ActivityType.TYPE_RELATIVE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
* Exiting device status.
*/
function on(type: ActivityType.TYPE_RELATIVE_STILL, eventType: EventType, reportLatencyNs: number, callback: AsyncCallback<RelativeStillResponse>): void;
EXIT = 2
}
/**
* Subscribe to the vertical position
* Subscribes to the device status.
*
* @param activity Indicates the device status type. For details, see {@code type: ActivityType}.
* @param event Indicates the device status event.
* @param reportLatencyNs Indicates the event reporting period.
* @param callback Indicates the callback for receiving reported data.
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
* @param type Subscribe to the vertical position, {@code type: ActivityType.TYPE_VERTICAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: ActivityType.TYPE_VERTICAL_POSITION, eventType: EventType, reportLatencyNs: number, callback: AsyncCallback<VerticalPositionResponse>): void;
function on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void;
/**
* Subscribe to horizontal locations
* Obtains the device status.
*
* @param activity Indicates the device status type. For details, see {@code type: ActivityType}.
* @param callback Indicates the callback for receiving reported data.
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
* @param type Subscribe to horizontal locations, {@code type: ActivityType.TYPE_HORIZONTAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: ActivityType.TYPE_HORIZONTAL_POSITION, eventType: EventType, reportLatencyNs: number, callback: AsyncCallback<HorizontalPositionResponse>): void;
function once(activity: ActivityType, callback: Callback<ActivityResponse>): void;
/**
* Query whether it is absolutely static
* Unsubscribes from the device status.
*
* @param activity Indicates the device status type. For details, see {@code type: ActivityType}.
* @param event Indicates the device status event.
* @param callback Indicates the callback for receiving reported data.
* @syscap SystemCapability.Msdp.DeviceStatus
* @since 9
* @param type Query whether it is absolutely static, {@code type: ActivityType.TYPE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function once(type: ActivityType.TYPE_STILL, callback: AsyncCallback<StillResponse>): void;
/**
* Query whether it is relatively stationary
*
* @since 9
* @param type Query whether it is relatively stationary, {@code type: ActivityType.TYPE_RELATIVE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function once(type: ActivityType.TYPE_RELATIVE_STILL, callback: AsyncCallback<RelativeStillResponse>): void;
/**
* Query whether the vertical position is
*
* @since 9
* @param type Query whether the vertical position is, {@code type: ActivityType.TYPE_VERTICAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function once(type: ActivityType.TYPE_VERTICAL_POSITION, callback: AsyncCallback<VerticalPositionResponse>): void;
/**
* Query whether the horizontal position is
*
* @since 9
* @param type Query whether the horizontal position is, {@code type: ActivityType.TYPE_HORIZONTAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function once(type: ActivityType.TYPE_HORIZONTAL_POSITION, callback: AsyncCallback<HorizontalPositionResponse>): void;
/**
* Unsubscribe absolutely static
*
* @since 9
* @param type Unsubscribe absolutely static, {@code type: ActivityType.TYPE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function off(type: ActivityType.TYPE_STILL, eventType: EventType, callback?: AsyncCallback<void>): void;
/**
* Unsubscribe is relatively static
*
* @since 9
* @param type Unsubscribe is relatively static, {@code type: ActivityType.TYPE_RELATIVE_STILL}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function off(type: ActivityType.TYPE_RELATIVE_STILL, eventType: EventType, callback?: AsyncCallback<void>): void;
/**
* Unsubscribe from the vertical location
*
* @since 9
* @param type Unsubscribe from the vertical location, {@code type: ActivityType.TYPE_VERTICAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function off(type: ActivityType.TYPE_VERTICAL_POSITION, eventType: EventType, callback?: AsyncCallback<void>): void;
/**
* Unsubscribe from horizontal locations
*
* @since 9
* @param type Unsubscribe from horizontal locations, {@code type: ActivityType.TYPE_HORIZONTAL_POSITION}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function off(type: ActivityType.TYPE_HORIZONTAL_POSITION, eventType: EventType, callback?: AsyncCallback<void>): void;
function off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void;
}
export default DeviceStatus;
export default deviceStatus;

View File

@ -1,170 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Callback } from "./basic";
/**
* .
*
* @since 9
* @syscap SystemCapability.Msdp.Geofence
* @import import sensor from '@ohos.geofense'
* @permission N/A
*/
declare namespace geofence {
/**
* .
*
* @since 9
* @param type Indicate the type to subscribe, {@code GeofenceType.TYPE_POINT_FENCE}.
* @param option Optional parameters specify optional parameters for point fence, {@code Option}.
* @param callback callback function, receive reported data.
*/
function on(type: GeofenceType.TYPE_POINT_FENCE, option: PointOption, callback: Callback<PointFenceResponse>): void;
/**
* .
*
* @since 9
* @param type Indicate the type to subscribe, {@code GeofenceType.TYPE_POINT_FENCE}.
* @param option Optional parameters specify optional parameters for point fence, {@code Option}.
* @param callback callback function, receive reported data.
*/
function off(type: GeofenceType.TYPE_POINT_FENCE, option: PointOption, callback?: Callback<PointFenceResponse>): void;
/**
* .
*
* @since 9
* @param type Indicate the type to subscribe, {@code GeofenceType.TYPE_POLYGON_FENCE}.
* @param option Optional parameters specify optional parameters for reporting polygon fence, {@code Option}.
* @param callback callback function, receive reported data.
*/
function on(type: GeofenceType.TYPE_POLYGON_FENCE, option: PolygonOption, callback: Callback<PolygonFenceResponse>): void;
/**
* .
*
* @since 9
* @param type Indicate the type to subscribe, {@code GeofenceType.TYPE_POLYGON_FENCE}.
* @param option Optional parameters specify optional parameters for reporting polygon fence, {@code Option}.
* @param callback callback function, receive reported data.
*/
function off(type: GeofenceType.TYPE_POLYGON_FENCE, option: PolygonOption, callback?: Callback<PolygonFenceResponse>): void;
/**
*
*
* @since 9
* @param minuteTime time, greater than or equal to 0.
*/
function setFoolProofTime(inuteTime: number): void;
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export enum GeofenceType{
/**
* Point fence
*/
TYPE_POINT_FENCE = "typePointFence",
/**
* Polygon fence
*/
TYPE_POLYGON_FENCE = "typePolygonFence",
}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export enum GeofenceValue {
/**
* Outside the fence
*/
VALUE_OUTSIDE = "outside",
/**
* Inside the fence
*/
VALUE_INSIDE = "inside",
/**
* Enter the fence
*/
VALUE_ENTER = "enter",
/**
* Exit the fence
*/
VALUE_EXIT = "exit",
}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export interface PointOption {
/**
* Coordinates of the center point of the fence
*/
centerCoordinate: Array<number>;
/**
* Radius of fence
*/
radius: number;
}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export interface PolygonOption {
/**
* Keyword of fence
*/
keyword: string;
/**
* Type of fence
*/
type: string;
/**
* City of fence
*/
city: string;
}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export interface GeofenceResponse {
geofenceValue: GeofenceValue;
}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export interface PointFenceResponse extends GeofenceResponse {}
/**
*
* @syscap SystemCapability.Msdp.Geofence
*/
export interface PolygonFenceResponse extends GeofenceResponse {}
}
export default geofence;

215
api/@ohos.motion.d.ts vendored
View File

@ -1,215 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Callback } from "./basic";
/**
* Provides the ability to subscribe to gesture state.
*
* @since 9
* @sysCap SystemCapability.Sensors.Motion
* @devices phone, tablet
* @import import sensor from '@ohos.motion'
* @permission N/A
*/
declare namespace motion {
/**
* The basic data structure of gesture state events
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface MotionResponse {
motionValue: boolean
}
/**
* Pick up the data for the event
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface PickupResponse extends MotionResponse {}
/**
* Roll over the data for the event
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface FlipResponse extends MotionResponse {}
/**
* Data close to ear events
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface CloseToEarResponse extends MotionResponse {}
/**
* Shake the data of the event
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface ShakeResponse extends MotionResponse {}
/**
* Rotate the data for the event
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface RotateResponse extends MotionResponse {}
/**
* Two-finger swipe event data
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface TwoFingersPinchResponse extends MotionResponse {}
/**
* Three fingers swipe the data of the event
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export interface ThreeFingersSlideResponse extends MotionResponse {}
/**
* Gesture state type
* @devices phone, tablet
* @sysCap SystemCapability.Msdp.Motion
*/
export enum MotionType {
TYPE_PICKUP = "pickUp",
TYPE_CLOSE_TO_EAR = "closeToEar",
TYPE_FLIP = "flip",
TYPE_SHAKE = "shake",
TYPE_ROTATE = "rotate",
TYPE_TWO_FINGER_PINCH = "twoFingerPinch",
TYPE_THREE_FINGERS_SLIDE = "threeFingersSlide",
}
/**
* Subscribe to pick up gestures
* @param The type of gesture state that subscribes to, {@code type: MotionType.TYPE_PICKUP}.
* @param callback The Callback function that the user subscribes to.
* @since 9
*/
function on(type: MotionType.TYPE_PICKUP, callback: Callback<PickupResponse>): void;
/**
* Subscribe to the near ear gesture
* @param Subscribe to the gesture status type, {@code type: MotionType.TYPE_CLOSE_TO_EAR}.
* @param callback The Callback function that the user subscribes to.
* @since 9
*/
function on(type: MotionType.TYPE_CLOSE_TO_EAR, callback: Callback<CloseToEarResponse>): void;
/**
* Subscribe to the flip event gesture
* @param Subscribe to the gesture status type, {@code type: MotionType.TYPE_FLIP}.
* @param callback The Callback function that the user subscribes to.
* @since 9
*/
function on(type: MotionType.TYPE_FLIP, callback: Callback<FlipResponse>): void;
/**
* Subscribe to a shake gesture
* @param Subscribe to the gesture status type, {@code type: MotionType.TYPE_SHAKE}.
* @param callback The Callback function that the user subscribes to.
* @since 9
*/
function on(type: MotionType.TYPE_SHAKE, callback: Callback<ShakeResponse>): void;
/**
* Subscribe to the rotate gesture
* @param Subscribe to the gesture status type, {@code type: MotionType.TYPE_ROTATE}.
* @param callback The Callback function that the user subscribes to.
* @since 9
*/
function on(type: MotionType.TYPE_ROTATE, callback: Callback<RotateResponse>): void;
/**
* Subscribe to two-finger event gestures
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_TWO_FINGER_PINCH}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function on(type: MotionType.TYPE_TWO_FINGER_PINCH, callback?: Callback<TwoFingersPinchResponse>): void;
/**
* Subscribe to three-finger event gestures
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_THREE_FINGERS_SLIDE}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function on(type: MotionType.TYPE_THREE_FINGERS_SLIDE, callback?: Callback<ThreeFingersSlideResponse>): void;
/**
* Cancel the pick-up gesture
* @param , {@code type: MotionType.TYPE_PICKUP}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_PICKUP, callback?: Callback<PickupResponse>): void;
/**
* Cancel the close gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_CLOSE_TO_EAR}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_CLOSE_TO_EAR, callback?: Callback<CloseToEarResponse>): void;
/**
* Cancels the flip event gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_FLIP}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_FLIP, callback?: Callback<FlipResponse>): void;
/**
* Cancel the shake gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_SHAKE}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_SHAKE, callback?: Callback<ShakeResponse>): void;
/**
* Cancel the rotate gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_ROTATE}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_ROTATE, callback?: Callback<RotateResponse>): void;
/**
* Cancels the two-finger event gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_TWO_FINGER_PINCH}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_TWO_FINGER_PINCH, callback?: Callback<TwoFingersPinchResponse>): void;
/**
* Cancels from the three-finger event gesture
* @param Cancels the gesture state type, {@code type: MotionType.TYPE_THREE_FINGERS_SLIDE}.
* @param callback The User Cancels the Callback function.
* @since 9
*/
function off(type: MotionType.TYPE_THREE_FINGERS_SLIDE, callback?: Callback<ThreeFingersSlideResponse>): void;
}
export default motion;

View File

@ -1,204 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Callback } from "./basic";
/**
* Subscribe to user move status notifications
*
* @since 9
* @syscap SystemCapability.Msdp.Movement
* @import import sensor from '@ohos.movement'
* @permission N/A
*/
declare namespace movement {
/**
* The basic data structure of a move state event
* @syscap SystemCapability.Msdp.Movement
*/
export interface MovementResponse {
movementValue: MovementValue
}
/**
* Data on ride events
* @syscap SystemCapability.Msdp.Movement
*/
export interface InAutoResponse extends MovementResponse {}
/**
* Data on cycling events
* @syscap SystemCapability.Msdp.Movement
*/
export interface OnBicycleResponse extends MovementResponse {}
/**
* Walk the data of the event
* @syscap SystemCapability.Msdp.Movement
*/
export interface WalkingResponse extends MovementResponse {}
/**
* Data for running events
* @syscap SystemCapability.Msdp.Movement
*/
export interface RuningResponse extends MovementResponse {}
/**
* The move state type
* @syscap SystemCapability.Msdp.Movement
*/
export enum MovementType {
TYPE_IN_AUTO = "inAuto",
TYPE_ON_BICYCLE = "inBicycle",
TYPE_WALKING = "walking",
TYPE_RUNNING = "running",
}
/**
* The move status value
* @syscap SystemCapability.Msdp.Movement
*/
export enum MovementValue {
ENTER = 1,
EXIT = 2,
ENTER_EXIT = 3
}
/**
* Subscribe to notifications of the mobility status of your ride
*
* @since 9
* @param type Subscribe to notifications of the mobility status of your ride, {@code type: MovementType.TYPE_IN_AUTO}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: MovementType.TYPE_IN_AUTO, eventType: MovementValue, reportLatencyNs: number, callback: Callback<InAutoResponse>): void;
/**
* Subscribe to notifications of the movement status of your bike
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_ON_BICYCLE}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: MovementType.TYPE_ON_BICYCLE, eventType: MovementValue, reportLatencyNs: number, callback: Callback<OnBicycleResponse>): void;
/**
* Subscribe to mobile status notifications for walks
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_WALKING}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: MovementType.TYPE_WALKING, eventType: MovementValue, reportLatencyNs: number, callback: Callback<WalkingResponse>): void;
/**
* Subscribe to notifications of the movement status of your run
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_RUNNING}.
* @param eventType enter and exit event.
* @param reportLatencyNs report event latency.
* @param callback callback function, receive reported data.
*/
function on(type: MovementType.TYPE_RUNNING, eventType: MovementValue, reportLatencyNs: number, callback: Callback<RuningResponse>): void;
/**
* Check if you are in the car
*
* @since 9
* @param type The mobile state type of the subscription, {@code MovementType.TYPE_IN_AUTO}.
* @param callback callback function, receive reported data.
*/
function once(type: MovementType.TYPE_IN_AUTO, callback: Callback<InAutoResponse>): void;
/**
* Check if you're riding a bike
*
* @since 9
* @param type The mobile state type of the subscription, {@code MovementType.TYPE_ON_BICYCLE}.
* @param callback callback function, receive reported data.
*/
function once(type: MovementType.TYPE_ON_BICYCLE, callback: Callback<OnBicycleResponse>): void;
/**
* Query whether it is the status of walking
*
* @since 9
* @param type The mobile state type of the subscription, {@code MovementType.TYPE_WALKING}.
* @param callback callback function, receive reported data.
*/
function once(type: MovementType.TYPE_WALKING, callback: Callback<WalkingResponse>): void;
/**
* Query whether it is the status of running
*
* @since 9
* @param type The mobile state type of the subscription, {@code MovementType.TYPE_RUNNING}.
* @param callback callback function, receive reported data.
*/
function once(type: MovementType.TYPE_RUNNING, callback: Callback<RuningResponse>): void;
/**
* Unsubscribe from the ride's mobile status notification
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_IN_AUTO}.
* @param eventType enter and exit event.
* @param callback callback function, receive reported data.
*/
function off(type: MovementType.TYPE_IN_AUTO, eventType: MovementValue, callback?: Callback<InAutoResponse>): void;
/**
* Unsubscribe from the bike's mobile status notification
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_ON_BICYCLE}.
* @param eventType enter and exit event.
* @param callback callback function, receive reported data.
*/
function off(type: MovementType.TYPE_ON_BICYCLE, eventType: MovementValue, callback?: Callback<OnBicycleResponse>): void;
/**
* Unsubscribe from mobile status notifications for walks
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_WALKING}.
* @param eventType enter and exit event.
* @param callback callback function, receive reported data.
*/
function off(type: MovementType.TYPE_WALKING, eventType: MovementValue, callback?: Callback<WalkingResponse>): void;
/**
* Unsubscribe from the run's motion status notification
*
* @since 9
* @param type The mobile state type of the subscription, {@code type: MovementType.TYPE_RUNNING}.
* @param eventType enter and exit event.
* @param callback callback function, receive reported data.
*/
function off(type: MovementType.TYPE_RUNNING, eventType: MovementValue, callback?: Callback<RuningResponse>): void;
}
export default movement;

View File

@ -1,238 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Callback } from './basic';
/**
* Provides registration and deregistration interfaces for spatial location
relationships between multiple devices, which are defined as follows:
* {@link on}: Subscribe to location relationships between devices
* {@link off}: Unsubscribe from the inter-device location relationship
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @permission N/A
*/
declare namespace spatialAwareness {
/**
* Bearing relationship definition
* @name DirectionResponse
*/
export interface DirectionResponse {
direction : Direction
}
/**
* Approach the relationship definition
* @name NearByResponse
*/
export interface NearByResponse {
nearby : boolean;
}
/**
* Distance relationship definition
* @name DistanceResponse
*/
export interface DistanceBTResponse {
distance : number;
}
/**
* Device information definition
*/
export interface DeviceInfo {
/**
* Device ID
*/
deviceId: string;
/**
* Device name
*/
deviceName: string;
/**
* Device type
*/
deviceType: DeviceType;
}
/**
* Location information definition
* @name PositionRelation
*/
export enum PositionRelation {
/**
* Represents an azimuth relationship
*/
DIRECTION = "direction",
/**
* Represents a distance relationship
*/
DISTANCE_BT = "distanceBT",
/**
* Represents a proximity relationship
*/
NEARBY = "nearby"
}
/**
* Device type definition
* @name DeviceType
*/
export enum DeviceType {
/**
* Represents an unknown device type
*/
UNKNOWN_TYPE = 1,
/**
* Represents a speaker
*/
SPEAKER = 2,
/**
* Represents a smartphone
*/
PHONE = 3,
/**
* Represents a tablet
*/
TABLET = 4,
/**
* Represents a smart wearable device
*/
WEARABLE = 5,
/**
* Represents a car
*/
CAR = 6,
/**
* Represents a Smart TV
*/
TV = 7
}
/**
* Azimuth relationship pattern definition
* @name Direction
*/
export enum Direction {
/**
* Represents the left side of the requesting device
*/
LEFT = 1,
/**
* Represents the right side of the requesting device
*/
RIGHT = 2,
/**
* Represented in front of the requesting device
*/
FRONT = 3,
/**
* Represented after the requested device
*/
BACK = 4,
/**
* Represented above the requesting device
*/
UP = 5,
/**
* Represented below the requesting device
*/
DOWN = 6
}
/**
* Spatial azimuth relationships between subscription devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Represents the device-to-device relationship type for a subscription {@code PositionRelation}.
* @param deviceInfo Represents the device information to subscribe to {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function on(type: PositionRelation.DIRECTION, deviceInfo : DeviceInfo,
callback: Callback<{ directionRes : DirectionResponse }>): void;
/**
* Spatial proximity between subscription devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Represents the device-to-device relationship type for a subscription {@code PositionRelation}.
* @param deviceInfo Represents the device information to subscribe to {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function on(type: PositionRelation.NEARBY, deviceInfo : DeviceInfo,
callback: Callback<{ nearbyRes: NearByResponse }>): void;
/**
* Spatial distance relationship between subscription devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Represents the device-to-device relationship type for a subscription {@code PositionRelation}.
* @param deviceInfo Represents the device information to subscribe to {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function on(type: PositionRelation.DISTANCE_BT, deviceInfo : DeviceInfo,
callback: Callback<{ distanceRes : DistanceBTResponse }>): void;
/**
* Unsubscribe from spatial azimuth relationships between devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Unsubscribe from spatial azimuth relationships between devices {@code PositionRelation}.
* @param deviceInfo Represents device information for unsubscribed {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function off(type: PositionRelation.DIRECTION, deviceInfo : DeviceInfo,
callback?: Callback<{ directionRes : DirectionResponse }>): void;
/**
* Unsubscribe from the space proximity relationship between devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Represents the device-to-device relationship type for a subscription {@code PositionRelation}.
* @param deviceInfo Represents device information for unsubscribed {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function off(type: PositionRelation.NEARBY, deviceInfo : DeviceInfo,
callback?: Callback<{ nearbyRes: NearByResponse }>): void;
/**
* Unsubscribe from the spatial distance relationship between devices
*
* @since 9
* @syscap SystemCapability.Msdp.SpatialAwareness
* @param type Represents the device-to-device relationship type for a subscription {@code PositionRelation}.
* @param deviceInfo Represents device information for unsubscribed {@code DeviceInfo}.
* @param callback callback function, receive reported data
*/
function off(type: PositionRelation.DISTANCE_BT, deviceInfo : DeviceInfo,
callback?: Callback<{ distanceRes : DistanceBTResponse }>): void;
}
export default spatialAwareness;

View File

@ -1,161 +0,0 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Callback } from "./basic";
/**
* 线
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @import import timeline from '@ohos.timeline'
* @permission N/A
*/
declare namespace timeline {
/**
* 线
* @syscap SystemCapability.Msdp.Timeline
*/
export enum TimelineArea {
AREA_HOME = "areaHome",
AREA_COMPANY = "areaCompany",
}
/**
* 线
* @syscap SystemCapability.Msdp.Timeline
*/
export class TimelineResponse {
timelineArea: TimelineArea
}
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param type Indicate the type to subscribe, {@code TimelineArea}.
* @param callback callback function, receive reported data.
*/
function on(type: "areaHome" | "areaCompany", callback: Callback<TimelineResponse>): void;
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param type Indicate the type to subscribe, {@code TimelineArea}.
* @param callback callback function, receive reported data.
*/
function off(type: "areaHome" | "areaCompany", callback?: Callback<TimelineResponse>): void;
/**
* 线
* @syscap SystemCapability.Msdp.Timeline
*/
export enum AbnormalEventType {
DISORDER_TRAJECTORY = "disorder",
UNUSUAL_TRAJECTORY = "unusual",
DIFFERENT_WITH_SETTING = "different",
}
/**
* 线
* @syscap SystemCapability.Msdp.Timeline
*/
export enum AbnormalType {
ABNORMAL = "abnormal"
}
/**
* 线
* @syscap SystemCapability.Msdp.Timeline
*/
export class AbnormalEventResponse {
abnormalEvent: string
}
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param type Indicate the type to subscribe, {@code AbnormalEventType}.
* @param callback callback function, receive reported data.
*/
function on(type: "abnormal", callback: Callback<AbnormalEventResponse>): void;
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param type Indicate the type to subscribe, {@code AbnormalEventType}.
* @param callback callback function, receive reported data.
*/
function off(type: "abnormal", callback?: Callback<AbnormalEventResponse>): void;
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param longitude longitude, ranging from -180 to 180.
* @param latitude latitude, ranging from -90 to 90.
*/
function setPosition(type: "areaHome" | "areaCompany", longitude: number, latitude: number): void;
/**
* .
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param value, 0 means day shift, 1 means night shift.
*/
function setDayAndNightShift(value: number): void;
/**
* Indicates the time setting type of the timeline for predicting user area.
* @syscap SystemCapability.Msdp.Timeline
*/
export enum UserTime {
SLEEPTIME = "sleepTime",
RESTTIME = "restTime",
WORKTIME = "workTime"
}
/**
* Set the time parameter for predicting user area.
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param start Start hour , ranging from 0 to 23.
* @param end End hour , ranging from 0 to 23.
*/
function setTime(type: "sleepTime" | "restTime" | "workTime", start: number, end: number): void;
/**
*
*
* @since 9
* @syscap SystemCapability.Msdp.Timeline
* @param hour ranging from 0 to 23.
* @param callback callback function, receive reported data.
*/
function getForcecastPosition(hour: number, callback: Callback<TimelineArea>): void
function getForcecastPosition(hour: number): Promise(TimelineArea)
}
export default timeline;