1 /* 2 * Copyright (C) 2021 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 /** 17 * @addtogroup Bluetooth 18 * @{ 19 * 20 * @brief Defines map client service interface, including observer and api functions. 21 * 22 * @since 6 23 */ 24 25 /** 26 * @file interface_profile_map_mce.h 27 * 28 * @brief map client interface. 29 * 30 * @since 6 31 */ 32 33 #ifndef INTERFACE_PROFILE_MAP_MCE_H 34 #define INTERFACE_PROFILE_MAP_MCE_H 35 36 #include "interface_profile.h" 37 #include "map_mce_parameter.h" 38 #include <vector> 39 40 namespace OHOS { 41 namespace bluetooth { 42 /** 43 * @brief map mce observer for framework api 44 * 45 * @since 6 46 */ 47 class IProfileMapMceObserver { 48 public: 49 /** 50 * @brief Destroy the IProfileMapMceObserver object 51 * 52 * @since 6 53 */ ~IProfileMapMceObserver()54 virtual ~IProfileMapMceObserver() {}; 55 /** 56 * @brief action completed observer 57 * 58 * @param deviceAddress bluetooth address 59 * @param action 60 * @param status 61 * @since 6 62 */ OnMapActionCompleted(const RawAddress & deviceAddress,const IProfileMapAction & action,MapExecuteStatus status)63 virtual void OnMapActionCompleted( 64 const RawAddress &deviceAddress, const IProfileMapAction &action, MapExecuteStatus status) {}; 65 /** 66 * @brief event report observer 67 * 68 * @param deviceAddress bluetooth address 69 * @param report 70 * @since 6 71 */ OnMapEventReported(const RawAddress & deviceAddress,const IProfileMapEventReport & report)72 virtual void OnMapEventReported(const RawAddress &deviceAddress, const IProfileMapEventReport &report) {}; 73 /** 74 * @brief ConnectionState Changed 75 * 76 * @param deviceAddress bluetooth address 77 * @param state changed status 78 * @since 6 79 */ OnConnectionStateChanged(const RawAddress & deviceAddress,int state)80 virtual void OnConnectionStateChanged(const RawAddress &deviceAddress, int state) {}; 81 /** 82 * @brief Bmessage completed observer 83 * 84 * @param deviceAddress bluetooth address 85 * @param bmsg 86 * @param status 87 * @since 6 88 */ OnBmessageCompleted(const RawAddress & deviceAddress,const IProfileBMessage & bmsg,MapExecuteStatus status)89 virtual void OnBmessageCompleted( 90 const RawAddress &deviceAddress, const IProfileBMessage &bmsg, MapExecuteStatus status) {}; 91 /** 92 * @brief MessagesListing completed observer 93 * 94 * @param deviceAddress bluetooth address 95 * @param bmsg 96 * @param status 97 * @since 6 98 */ OnMessagesListingCompleted(const RawAddress & deviceAddress,const IProfileMessagesListing & listing,MapExecuteStatus status)99 virtual void OnMessagesListingCompleted( 100 const RawAddress &deviceAddress, const IProfileMessagesListing &listing, MapExecuteStatus status) {}; 101 /** 102 * @brief ConversationListing completed observer 103 * 104 * @param deviceAddress bluetooth address 105 * @param listing 106 * @param status 107 * @since 6 108 */ OnConversationListingCompleted(const RawAddress & deviceAddress,const IProfileConversationListing & listing,MapExecuteStatus status)109 virtual void OnConversationListingCompleted( 110 const RawAddress &deviceAddress, const IProfileConversationListing &listing, MapExecuteStatus status) {}; 111 }; 112 113 class IProfileMapMce : public IProfile { 114 public: 115 /** 116 * @brief register observer 117 * 118 * @param observer function pointer 119 * @since 6 120 */ 121 virtual void RegisterObserver(IProfileMapMceObserver &observer) = 0; 122 /** 123 * @brief deregister observer 124 * 125 * @param observer function pointer 126 * @since 6 127 */ 128 virtual void DeregisterObserver(IProfileMapMceObserver &observer) = 0; 129 /** 130 * @brief check connect status 131 * 132 * @param device Bluetooth Device address 133 * @return true success 134 * @return false failed 135 * @since 6 136 */ 137 virtual bool IsConnected(const RawAddress &device) = 0; 138 /** 139 * @brief Get the Devices By States object 140 * 141 * @param states device state 142 * @return std::vector<RawAddress> Bluetooth Device list 143 * @since 6 144 */ 145 virtual std::vector<RawAddress> GetDevicesByStates(const std::vector<int> &statusList) = 0; 146 /** 147 * @brief Set the Connection Strategy object 148 * 149 * @param device Bluetooth Device address 150 * @param strategy strategy 151 * @return int 152 * @since 6 153 */ 154 virtual int SetConnectionStrategy(const RawAddress &device, int strategy) = 0; 155 /** 156 * @brief Get the Connection Strategy object 157 * 158 * @param device Bluetooth Device address 159 * @return int 160 * @since 6 161 */ 162 virtual int GetConnectionStrategy(const RawAddress &device) const = 0; 163 /** 164 * @brief Get the Unread Messages object 165 * @param device Bluetooth Device address 166 * @param type message type 167 * @param maxListCount iterm number 168 * @return int 169 * @since 6 170 */ 171 virtual int GetUnreadMessages(const RawAddress &device, MapMessageType type, uint8_t max) = 0; 172 /** 173 * @brief Get the Supported Features object request 174 * 175 * @param device Bluetooth Device address 176 * @return int 177 * @since 6 178 */ 179 virtual int GetSupportedFeatures(const RawAddress &device) = 0; 180 /** 181 * @brief send new messange request 182 * 183 * @param device Bluetooth Device address 184 * @param msg 185 * @return int 186 * @since 6 187 */ 188 virtual int SendMessage(const RawAddress &device, const IProfileSendMessageParameters &msg) = 0; 189 /** 190 * @brief Set the Notification Filter object request 191 * 192 * @param device Bluetooth Device address 193 * @param on 194 * @return int 195 * @since 6 196 */ 197 virtual int SetNotificationFilter(const RawAddress &device, const int mask) = 0; 198 /** 199 * @brief Set the Notification Filter object request 200 * 201 * @param device Bluetooth Device address 202 * @param on 203 * @return int 204 * @since 6 205 */ 206 virtual int SetNotificationRegistration(const RawAddress &device, const bool on) = 0; 207 /** 208 * @brief Get the Messages Listing object request 209 * 210 * @param device Bluetooth Device address 211 * @param para 212 * @return int 213 * @since 6 214 */ 215 virtual int GetMessagesListing(const RawAddress &device, const IProfileGetMessagesListingParameters ¶) = 0; 216 /** 217 * @brief Get the Message object request 218 * 219 * @param device Bluetooth Device address 220 * @param msgHandle 221 * @param para 222 * @return int 223 * @since 6 224 */ 225 virtual int GetMessage(const RawAddress &device, MapMessageType type, const std::u16string &msgHandle, 226 const IProfileGetMessageParameters ¶) = 0; 227 /** 228 * @brief update inbox request 229 * 230 * @param device Bluetooth Device address 231 * @return int 232 * @since 6 233 */ 234 virtual int UpdateInbox(const RawAddress &device, MapMessageType type) = 0; 235 /** 236 * @brief Get the Conversation Listing object 237 * 238 * @param device Bluetooth Device address 239 * @param para 240 * @return int 241 * @since 6 242 */ 243 virtual int GetConversationListing( 244 const RawAddress &device, const IProfileGetConversationListingParameters ¶) = 0; 245 /** 246 * @brief Set the Message Status object 247 * @param device 248 * @param type 249 * @param msgStatus 250 * @return int 251 */ 252 virtual int SetMessageStatus(const RawAddress &device, MapMessageType type, 253 const IProfileSetMessageStatus &msgStatus) = 0; 254 /** 255 * @brief Set the Owner Status object 256 * 257 * @param device Bluetooth Device address 258 * @param para 259 * @return int 260 * @since 6 261 */ 262 virtual int SetOwnerStatus(const RawAddress &device, const IProfileSetOwnerStatusParameters ¶) = 0; 263 /** 264 * @brief Get the Owner Status object 265 * 266 * @param device Bluetooth Device address 267 * @param conversationId 268 * @return int 269 * @since 6 270 */ 271 virtual int GetOwnerStatus(const RawAddress &device, const std::string &conversationId) = 0; 272 /** 273 * @brief Get the Connect State object 274 * 275 * @return int 276 * @since 6 277 */ 278 virtual int GetDeviceConnectState(const RawAddress &device) = 0; 279 /** 280 * @brief Get the Mas Instance Info object 281 * 282 * @param device bluetooth address 283 * @return int 284 * @since 6 285 */ 286 virtual IProfileMasInstanceInfoList GetMasInstanceInfo(const RawAddress &device) = 0; 287 /** 288 * @brief Get folder listing 289 * 290 * @param device bluetooth address 291 * @param maxOfListCount max of list count 292 * @param startOffset start offset 293 * @return int 294 * @since 6 295 */ 296 virtual int GetFolderListing(const RawAddress &device, uint16_t maxOfListCount, uint16_t startOffset) = 0; 297 /** 298 * @brief set folder path 299 * 300 * @param device bluetooth address 301 * @param flags flags control 302 * 0x02: Go down 1 level 303 * 0x02: Go back to root , if choice this , don't input the folder and the folder list 304 * 0x03: Go up 1 level 305 * 0x04: path name, folder name list valid 306 * @param folder folder name, only valid in flags 0x02 or 0x03 307 * @param folderList folder list, only valid in flags 0x04 308 * @return int 309 * @since 6 310 */ 311 virtual int SetPath(const RawAddress &device, const uint8_t flags, const std::u16string &folder, 312 std::vector<std::u16string> &folderList) = 0; 313 }; 314 } // namespace bluetooth 315 } // namespace OHOS 316 #endif // INTERFACE_PROFILE_MAP_MCE_H 317