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 PLUGIN_SERVICE_IMPL_H 17 #define PLUGIN_SERVICE_IMPL_H 18 19 #include "logging.h" 20 #include "plugin_service.ipc.h" 21 #include "socket_context.h" 22 class PluginService; 23 24 using GetCommandResponsePtr = STD_PTR(shared, ::GetCommandResponse); 25 26 class PluginServiceImpl final : public IPluginServiceServer { 27 public: 28 explicit PluginServiceImpl(PluginService& p); 29 ~PluginServiceImpl(); 30 bool RegisterPlugin(SocketContext& context, 31 ::RegisterPluginRequest& request, 32 ::RegisterPluginResponse& response) override; 33 bool UnregisterPlugin(SocketContext& context, 34 ::UnregisterPluginRequest& request, 35 ::UnregisterPluginResponse& response) override; 36 bool GetCommand(SocketContext& context, ::GetCommandRequest& request, ::GetCommandResponse& response) override; 37 bool 38 NotifyResult(SocketContext& context, ::NotifyResultRequest& request, ::NotifyResultResponse& response) override; 39 40 bool PushCommand(SocketContext& context, GetCommandResponsePtr command); 41 42 private: 43 PluginService* pluginService; 44 }; 45 46 #endif // PLUGIN_SERVICE_IMPL_H 47