diff --git a/activity_recognition/bundle.json b/activity_recognition/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..38562388e827456e181c7b5ba4140de2134ad014 --- /dev/null +++ b/activity_recognition/bundle.json @@ -0,0 +1,50 @@ +{ + "name": "drivers_interface_act_recg", + "description": "activity recognition device driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "drivers_interface_act_recg", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "150KB", + "ram": "200KB", + "deps": { + "components": [ + "ipc", + "hdf_core", + "hiviewdfx_hilog_native", + "utils_base" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/interface/activity_recognition/v1_0:ar_idl_target" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/activity_recognition/v1_0:libar_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/activity_recognition" + } + }, + { + "name": "//drivers/interface/activity_recognition/v1_0:ar_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/activity_recognition" + } + } + ] + } + } + } \ No newline at end of file diff --git a/activity_recognition/v1_0/ActivityRecognitionTypes.idl b/activity_recognition/v1_0/ActivityRecognitionTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..db70ba1756ba41975da551b86b8f93348ec4277f --- /dev/null +++ b/activity_recognition/v1_0/ActivityRecognitionTypes.idl @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package ohos.hdi.activity_recognition.v1_0; + +enum ActRecognitionEventType { + ACT_RECOGNITION_EVENT_ENTER = 0x01, + ACT_RECOGNITION_EVENT_EXIT = 0x02, +}; + +enum ActRecognitionPowerMode { + ACT_RECOGNITION_NORMAL_MODE = 0, + ACT_RECOGNITION_LOW_POWER_MODE = 1, +}; + +struct ActRecognitionEvent { + int activity; + int eventType; + long timestamp; + int confidence; +}; \ No newline at end of file diff --git a/activity_recognition/v1_0/BUILD.gn b/activity_recognition/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..224e521c503c4e3ca1ffa350f434539ae2877b05 --- /dev/null +++ b/activity_recognition/v1_0/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2021 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("//drivers/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("ar") { + module_name = "ar_service" + + sources = [ + "ActivityRecognitionTypes.idl", + "IActivityChangedCallback.idl", + "IActivityInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_act_recg" +} diff --git a/activity_recognition/v1_0/IActivityChangedCallback.idl b/activity_recognition/v1_0/IActivityChangedCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..bf9db816977ab5323080a4484fe0a92796338d8d --- /dev/null +++ b/activity_recognition/v1_0/IActivityChangedCallback.idl @@ -0,0 +1,22 @@ +/* + * 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. + */ + +package ohos.hdi.activity_recognition.v1_0; + +import ohos.hdi.activity_recognition.v1_0.ActivityRecognitionTypes; + +[callback] interface IActivityChangedCallback { + OnActivityChanged([in] struct ActRecognitionEvent[] event); +} \ No newline at end of file diff --git a/activity_recognition/v1_0/IActivityInterface.idl b/activity_recognition/v1_0/IActivityInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..682e42cd5641aa1e31b87575b0798ecfa285228d --- /dev/null +++ b/activity_recognition/v1_0/IActivityInterface.idl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package ohos.hdi.activity_recognition.v1_0; + +import ohos.hdi.activity_recognition.v1_0.ActivityRecognitionTypes; +import ohos.hdi.activity_recognition.v1_0.IActivityChangedCallback; + +interface IActivityInterface { + + RegisterActRecognitionCallback([in] IActivityChangedCallback callbackObj); + + UnregisterActRecognitionCallback([in] IActivityChangedCallback callbackObj); + + GetSupportActivity([out] String[] activity); + + GetCurrentActivity([out] struct ActRecognitionEvent[] event); + + EnableActRecognitionEvent([in] int activity, [in] int eventType, [in] long maxReportLatencyNs, [in] int powerMode); + + DisableActRecognitionEvent([in] int activity, [in] int eventType); + + FlushActivity(); +} \ No newline at end of file