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 #ifndef OHOS_ABILITY_RUNTIME_REMOTE_REGISTER_SERVICE_INTERFACE_H 17 #define OHOS_ABILITY_RUNTIME_REMOTE_REGISTER_SERVICE_INTERFACE_H 18 19 #include <string> 20 #include <memory> 21 #include "iremote_broker.h" 22 #include "extra_params.h" 23 #include "connect_callback_interface.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 class IRemoteRegisterService : public IRemoteBroker { 28 public: 29 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.RemoteRegisterService"); 30 31 IRemoteRegisterService() = default; 32 virtual ~IRemoteRegisterService() = default; 33 34 /** 35 * register to controlcenter continuation register service. 36 * 37 * @param bundleName bundlename of ability. 38 * @param extras filter with supported device list. 39 * @param callback callback for device connect and disconnect. 40 */ 41 virtual int Register(const std::string &bundleName, const sptr<IRemoteObject> &token, const ExtraParams &extras, 42 const sptr<IConnectCallback> &callback) = 0; 43 44 /** 45 * unregister to controlcenter continuation register service. 46 * 47 * @param registerToken token from register return value. 48 */ 49 virtual bool Unregister(int registerToken) = 0; 50 51 /** 52 * notify continuation status to controlcenter continuation register service. 53 * 54 * @param registerToken token from register. 55 * @param deviceId deviceid. 56 * @param status device status. 57 */ 58 virtual bool UpdateConnectStatus(int registerToken, const std::string &deviceId, int status) = 0; 59 60 /** 61 * notify controlcenter continuation register service to show device list. 62 * 63 * @param registerToken token from register 64 * @param extras filter with supported device list. 65 */ 66 virtual bool ShowDeviceList(int registerToken, const ExtraParams &extras) = 0; 67 68 enum { 69 // ipc id for register 70 COMMAND_REGISTER = 1, 71 COMMAND_UNREGISTER, 72 COMMAND_UPDATE_CONNECT_STATUS, 73 COMMAND_SHOW_DEVICE_LIST 74 }; 75 }; 76 } // namespace AppExecFwk 77 } // namespace OHOS 78 #endif // OHOS_ABILITY_RUNTIME_REMOTE_REGISTER_SERVICE_INTERFACE_H 79