• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DEVICESTATUS_DATA_UTILS_H
17 #define DEVICESTATUS_DATA_UTILS_H
18 
19 #include<string>
20 
21 namespace OHOS {
22 namespace Msdp {
23 class DevicestatusDataUtils {
24 public:
25     enum DevicestatusType {
26         TYPE_INVALID = -1,
27         TYPE_STILL,
28         TYPE_RELATIVE_STILL,
29         TYPE_CAR_BLUETOOTH,
30 		TYPE_STAND,
31         TYPE_LID_OPEN,
32         TYPE_MAX
33     };
34 
35     enum DevicestatusValue {
36         VALUE_INVALID = -1,
37         VALUE_ENTER = 1,
38         VALUE_EXIT
39     };
40 
41     enum Value {
42         INVALID = 0,
43         VALID
44     };
45 
46     struct DevicestatusData {
47         DevicestatusType type = TYPE_INVALID;
48         DevicestatusValue value = VALUE_INVALID;
49     };
50     struct AlgoData {
51         float x = 0.0;
52         float y = 0.0;
53         float z = 0.0;
54         double resultantAcc = 0.0;
55         double pitch = 0.0;
56         double roll = 0.0;
57     };
58 };
59 
60 
61 typedef struct DeviceStatusJsonData {
62     int32_t type;
63     std::string json;
64 }DeviceStatusJsonD;
65 
66 static DeviceStatusJsonD DeviceStatusJson[] = {
67     {DevicestatusDataUtils::DevicestatusType::TYPE_STILL, "TYPE_STILL"},
68     {DevicestatusDataUtils::DevicestatusType::TYPE_RELATIVE_STILL, "TYPE_RELATIVE_STILL"},
69     {DevicestatusDataUtils::DevicestatusType::TYPE_CAR_BLUETOOTH, "TYPE_CAR_BLUETOOTH"},
70     {DevicestatusDataUtils::DevicestatusType::TYPE_STAND, "TYPE_STAND"},
71     {DevicestatusDataUtils::DevicestatusType::TYPE_LID_OPEN, "TYPE_LID_OPEN"}
72 };
73 } // namespace Msdp
74 } // namespace OHOS
75 #endif // DEVICESTATUS_DATA_UTILS_H
76