service_utility.h revision e4eec20f6263f4a42ae462456f60ea6c4518bb0a
1#ifndef ANDROID_PDX_DEFAULT_TRANSPORT_SERVICE_UTILITY_H_ 2#define ANDROID_PDX_DEFAULT_TRANSPORT_SERVICE_UTILITY_H_ 3 4#include <pdx/client.h> 5#include <pdx/default_transport/client_channel_factory.h> 6#include <pdx/service.h> 7#include <pdx/status.h> 8 9namespace android { 10namespace pdx { 11namespace default_transport { 12 13class ServiceUtility : public ClientBase<ServiceUtility> { 14 public: 15 Status<int> ReloadSystemProperties() { 16 Transaction transaction{*this}; 17 return ReturnStatusOrError( 18 transaction.Send<int>(opcodes::REPORT_SYSPROP_CHANGE)); 19 } 20 21 static std::string GetRootEndpointPath() { 22 return ClientChannelFactory::GetRootEndpointPath(); 23 } 24 static std::string GetEndpointPath(const std::string& endpoint_path) { 25 return ClientChannelFactory::GetEndpointPath(endpoint_path); 26 } 27 28 private: 29 friend BASE; 30 31 ServiceUtility(const std::string& endpoint_path, int* error = nullptr) 32 : BASE(ClientChannelFactory::Create(endpoint_path)) { 33 if (error) 34 *error = Client::error(); 35 } 36 37 ServiceUtility(const ServiceUtility&) = delete; 38 void operator=(const ServiceUtility&) = delete; 39}; 40 41} // namespace default_transport 42} // namespace pdx 43} // namespace android 44 45#endif // ANDROID_PDX_DEFAULT_TRANSPORT_SERVICE_UTILITY_H_ 46