23 #include "hardware/GPIO_odb.h" 39 "Base device serialization did something unexpected.");
42 serialized[
"type"] =
"led";
48 ASSERT_LOG(hwd_service,
"No hardware service.");
50 serialized[
"relationships"][
"gpio"] =
51 hwd_service->serialize_device_metadata(in.
gpio());
59 using namespace JSONUtil;
71 out.
gpio(odb::lazy_shared_ptr<Hardware::GPIO>(*db->db(), gpio_id).load());
std::chrono::system_clock::time_point extract_with_default(const nlohmann::json &obj, const std::string &key, const std::chrono::system_clock::time_point &tp)
Extract an ISO 8601 datetime string from a json object.
static void unserialize(Hardware::LED &out, const json &in, const SecurityContext &sc)
This is the header file for a generated source file, GitSHA1.cpp.
static void unserialize(Hardware::Device &out, const json &in, const SecurityContext &sc)
ServiceRegistry & get_service_registry()
A function to retrieve the ServiceRegistry from pretty much anywhere.
const GPIOPtr & gpio() const
int64_t default_blink_speed() const
Thin wrapper around boost::uuids::uuid.
static json serialize(const Hardware::LED &in, const SecurityContext &sc)
Database aware Hardware Service.
A SecurityContext is used to query permission while doing an operation.
Provides various database-related services to consumer.
#define ASSERT_LOG(cond, msg)
static json serialize(const Hardware::Device &in, const SecurityContext &sc)
std::shared_ptr< ServiceInterface > get_service() const
Retrieve the service instance implementing the ServiceInterface, or nullptr if no such service was re...
int64_t default_blink_duration() const
Abstraction of LED device attributes.