1 /*
2  * Copyright (C) 2024 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 #ifndef BT_SENSING_INFO_H
16 #define BT_SENSING_INFO_H
17 
18 #include <string>
19 #include "bt_def.h"
20 
21 namespace OHOS {
22 namespace bluetooth {
23 const std::string INVALID_UUID_STRING = "00000000-0000-0000-0000-000000000000";
24 const std::string INVALID_PKGNAME = "invalid_name";
25 
26 struct SensingInfo {
SensingInfoSensingInfo27     SensingInfo()
28         : addr_(INVALID_MAC_ADDRESS), uuid_(INVALID_UUID_STRING), resourceId_(0), pkgName_(INVALID_PKGNAME),
29         isServer_(false), interval_(0)
30     {}
~SensingInfoSensingInfo31     ~SensingInfo() {}
32 
33     // used by ble fastest conn decision
SensingInfoSensingInfo34     explicit SensingInfo(const std::string &addr)
35         : addr_(addr), uuid_(INVALID_UUID_STRING), resourceId_(0), pkgName_(INVALID_PKGNAME), isServer_(false),
36         interval_(0)
37     {}
38     // used by gatt connect SensingInfo construct
SensingInfoSensingInfo39     explicit SensingInfo(uint32_t resourceId)
40         : addr_(INVALID_MAC_ADDRESS), uuid_(INVALID_UUID_STRING), resourceId_(resourceId), pkgName_(INVALID_PKGNAME),
41         isServer_(false), interval_(0)
42     {}
SensingInfoSensingInfo43     SensingInfo(const std::string &addr, uint32_t resourceId)
44         : addr_(addr), uuid_(INVALID_UUID_STRING), resourceId_(resourceId), pkgName_(INVALID_PKGNAME),
45         isServer_(false), interval_(0)
46     {}
47     // used by gatt pkgName SensingInfo construct
SensingInfoSensingInfo48     SensingInfo(const std::string &pkgName, bool isServer)
49         : addr_(INVALID_MAC_ADDRESS), uuid_(INVALID_UUID_STRING), resourceId_(0), pkgName_(pkgName),
50         isServer_(isServer), interval_(0)
51     {}
SensingInfoSensingInfo52     SensingInfo(const std::string &addr, const std::string &pkgName, bool isServer)
53         : addr_(addr), uuid_(INVALID_UUID_STRING), resourceId_(0), pkgName_(pkgName), isServer_(isServer), interval_(0)
54     {}
55     // used by socket pkgName SensingInfo construct
SensingInfoSensingInfo56     SensingInfo(const std::string uuid, const std::string pkgName)
57         : addr_(INVALID_MAC_ADDRESS), uuid_(uuid), resourceId_(0), pkgName_(pkgName), isServer_(false), interval_(0)
58     {}
59     // used by ble conn interval update
SensingInfoSensingInfo60     SensingInfo(const std::string &addr, uint16_t interval)
61         : addr_(addr), uuid_(INVALID_UUID_STRING), resourceId_(0), pkgName_(INVALID_PKGNAME),
62         isServer_(false), interval_(interval)
63     {}
64     //used by stack sensing info transfer
SensingInfoSensingInfo65     SensingInfo(const std::string &addr, const std::string &uuid, uint32_t resourceId, uint16_t interval)
66         : addr_(addr), uuid_(uuid), resourceId_(resourceId), pkgName_(INVALID_PKGNAME), isServer_(false),
67         interval_(interval)
68     {}
69 
70     std::string addr_;
71     std::string uuid_;
72     uint32_t resourceId_;
73     std::string pkgName_;
74     bool isServer_;
75     uint16_t interval_;
76 };
77 }
78 }
79 
80 #endif //BT_SENSING_INFO_H