• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 opp service interface, including observer and api functions.
21  *
22  */
23 
24 /**
25  * @file interface_profile_opp.h
26  *
27  * @brief opp interface.
28  *
29  */
30 
31 #ifndef INTERFACE_PROFILE_OPP_H
32 #define INTERFACE_PROFILE_OPP_H
33 
34 #include "interface_profile.h"
35 #include "opp_transfer_information.h"
36 
37 namespace OHOS {
38 namespace bluetooth {
39 /**
40  * @brief opp observer for framework api
41  *
42  */
43 class IOppObserver {
44 public:
45     /**
46      * @brief Destroy the IOppObserver object
47      *
48      */
49     virtual ~IOppObserver() = default;
50     /**
51      * @brief  Receive a incoming file request.
52      *
53      * @param  info file information
54      */
OnReceiveIncomingFile(const IOppTransferInformation & info)55     virtual void OnReceiveIncomingFile(const IOppTransferInformation &info) {}
56     /**
57      * @brief  Notify the transfer's state changed.
58      *
59      * @param  info file information
60      */
OnTransferStateChange(const IOppTransferInformation & info)61     virtual void OnTransferStateChange(const IOppTransferInformation &info) {}
62 };
63 
64 class IProfileOpp : public IProfile {
65 public:
66     /**
67      * @brief  register observer
68      *
69      * @param  observer  function pointer
70      */
71     virtual void RegisterObserver(IOppObserver &observer) = 0;
72     /**
73      * @brief  deregister observer
74      *
75      * @param  observer  function pointer
76      */
77     virtual void DeregisterObserver(IOppObserver &observer) = 0;
78     /**
79      * @brief Get remote device list which are in the specified states.
80      *
81      * @param states  List of remote device states.
82      * @return Returns the list of devices.
83      */
84     virtual std::vector<RawAddress> GetDevicesByStates(std::vector<int> states) = 0;
85     /**
86      * @brief Get the connection state of the specified remote device.
87      *
88      * @param device  Remote device object.
89      * @return Returns the connection state of the remote device.
90      */
91     virtual int GetDeviceState(const RawAddress &device) = 0;
92 
93     virtual int SendFile(const RawAddress &device, const std::vector<std::string> filePaths,
94         const std::vector<std::string> mimeTypes) = 0;
95     virtual int SetIncomingFileConfirmation(const bool accept) = 0;
96     virtual IOppTransferInformation GetCurrentTransferInformation() = 0;
97     virtual int CancelTransfer() = 0;
98 };
99 }  // namespace bluetooth
100 }  // namespace OHOS
101 #endif  // INTERFACE_PROFILE_OPP_H