ESPHome 2025.5.0
Loading...
Searching...
No Matches
user_services.cpp
Go to the documentation of this file.
1#include "user_services.h"
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace api {
6
7template<> bool get_execute_arg_value<bool>(const ExecuteServiceArgument &arg) { return arg.bool_; }
9 if (arg.legacy_int != 0)
10 return arg.legacy_int;
11 return arg.int_;
12}
13template<> float get_execute_arg_value<float>(const ExecuteServiceArgument &arg) { return arg.float_; }
14template<> std::string get_execute_arg_value<std::string>(const ExecuteServiceArgument &arg) { return arg.string_; }
15template<> std::vector<bool> get_execute_arg_value<std::vector<bool>>(const ExecuteServiceArgument &arg) {
16 return arg.bool_array;
17}
18template<> std::vector<int32_t> get_execute_arg_value<std::vector<int32_t>>(const ExecuteServiceArgument &arg) {
19 return arg.int_array;
20}
21template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) {
22 return arg.float_array;
23}
24template<> std::vector<std::string> get_execute_arg_value<std::vector<std::string>>(const ExecuteServiceArgument &arg) {
25 return arg.string_array;
26}
27
42
43} // namespace api
44} // namespace esphome
@ SERVICE_ARG_TYPE_BOOL_ARRAY
Definition api_pb2.h:79
@ SERVICE_ARG_TYPE_STRING_ARRAY
Definition api_pb2.h:82
@ SERVICE_ARG_TYPE_FLOAT_ARRAY
Definition api_pb2.h:81
float get_execute_arg_value< float >(const ExecuteServiceArgument &arg)
bool get_execute_arg_value< bool >(const ExecuteServiceArgument &arg)
int32_t get_execute_arg_value< int32_t >(const ExecuteServiceArgument &arg)
enums::ServiceArgType to_service_arg_type()
enums::ServiceArgType to_service_arg_type< int32_t >()
enums::ServiceArgType to_service_arg_type< bool >()
enums::ServiceArgType to_service_arg_type< std::string >()
std::string get_execute_arg_value< std::string >(const ExecuteServiceArgument &arg)
T get_execute_arg_value(const ExecuteServiceArgument &arg)
enums::ServiceArgType to_service_arg_type< float >()
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7