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 #ifndef FOUNDATION_ABILITY_FORM_FWK_SERVICES_INCLUDE_FORM_SHARE_CONNECTION_H 17 #define FOUNDATION_ABILITY_FORM_FWK_SERVICES_INCLUDE_FORM_SHARE_CONNECTION_H 18 19 #include "event_handler.h" 20 #include "form_ability_connection.h" 21 #include "want.h" 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 using WantParams = OHOS::AAFwk::WantParams; 26 using Want = OHOS::AAFwk::Want; 27 28 /** 29 * @class FormShareConnection 30 * Form share connection stub. 31 */ 32 class FormShareConnection : public FormAbilityConnection { 33 public: 34 FormShareConnection(int64_t formId, const std::string &bundleName, const std::string &abilityName, 35 const std::string &deviceId, int64_t formShareRequestCode); 36 37 virtual ~FormShareConnection() = default; 38 39 /** 40 * @brief OnAbilityConnectDone, AbilityMs notify caller ability the result of connect. 41 * @param element service ability's ElementName. 42 * @param remoteObject The session proxy of service ability. 43 * @param resultCode ERR_OK on success, others on failure. 44 */ 45 void OnAbilityConnectDone( 46 const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int32_t resultCode) override; 47 48 private: 49 int64_t formId_ {-1}; 50 std::string remoteDeviceId_ {""}; 51 int64_t formShareRequestCode_ {0}; 52 DISALLOW_COPY_AND_MOVE(FormShareConnection); 53 }; 54 } // namespace AppExecFwk 55 } // namespace OHOS 56 #endif // FOUNDATION_ABILITY_FORM_FWK_SERVICES_INCLUDE_FORM_SHARE_CONNECTION_H 57