Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
service_entry.h
1#ifndef SERVICE_ENTRY_H
2#define SERVICE_ENTRY_H
3
4#include <stdint.h>
5#include "./entry.h"
6
7namespace ara
8{
9 namespace com
10 {
11 namespace entry
12 {
14 class ServiceEntry : public Entry
15 {
16 private:
17 static const uint32_t cInfiniteTtl = 0xffffff;
18
19 uint32_t mMinorVersion;
20
22 uint16_t serviceId,
23 uint16_t instanceId,
24 uint32_t ttl,
25 uint8_t majorVersion,
26 uint32_t minorVersion) noexcept;
27
28 protected:
29 virtual bool ValidateOption(
30 const option::Option *option) const noexcept override;
31
32 public:
34 static const uint32_t cAnyMinorVersion = 0xffffffff;
35
36 ServiceEntry() = delete;
38
39 ServiceEntry &operator=(ServiceEntry &&other);
40
43 uint32_t MinorVersion() const noexcept;
44
45 virtual std::vector<uint8_t> Payload(uint8_t &optionIndex) const override;
46
54 static std::unique_ptr<ServiceEntry> CreateFindServiceEntry(
55 uint16_t serviceId,
56 uint32_t ttl = cInfiniteTtl,
57 uint16_t instanceId = cAnyInstanceId,
58 uint8_t majorVersion = cAnyMajorVersion,
59 uint32_t minorVersion = cAnyMinorVersion);
60
68 static std::unique_ptr<ServiceEntry> CreateOfferServiceEntry(
69 uint16_t serviceId,
70 uint16_t instanceId,
71 uint8_t majorVersion,
72 uint32_t minorVersion,
73 uint32_t ttl = cInfiniteTtl);
74
81 static std::unique_ptr<ServiceEntry> CreateStopOfferEntry(
82 uint16_t serviceId,
83 uint16_t instanceId,
84 uint8_t majorVersion,
85 uint32_t minorVersion) noexcept;
86
97 static std::unique_ptr<ServiceEntry> Deserialize(
98 const std::vector<uint8_t> &payload,
99 std::size_t &offset,
100 EntryType type,
101 uint16_t serviceId,
102 uint16_t instanceId,
103 uint32_t ttl,
104 uint8_t majorVersion);
105 };
106 }
107 }
108}
109
110#endif
Communication message abstract entry.
Definition: entry.h:28
static const uint16_t cAnyInstanceId
Any service instance ID.
Definition: entry.h:68
static const uint8_t cAnyMajorVersion
Any service major version.
Definition: entry.h:70
Entry to find and offer a service.
Definition: service_entry.h:15
virtual std::vector< uint8_t > Payload(uint8_t &optionIndex) const override
Get entity payload.
Definition: service_entry.cpp:50
uint32_t MinorVersion() const noexcept
Get minor version.
Definition: service_entry.cpp:45
static std::unique_ptr< ServiceEntry > CreateFindServiceEntry(uint16_t serviceId, uint32_t ttl=cInfiniteTtl, uint16_t instanceId=cAnyInstanceId, uint8_t majorVersion=cAnyMajorVersion, uint32_t minorVersion=cAnyMinorVersion)
Find a service entry factory.
Definition: service_entry.cpp:58
static const uint32_t cAnyMinorVersion
Any service minor version.
Definition: service_entry.h:34
static std::unique_ptr< ServiceEntry > Deserialize(const std::vector< uint8_t > &payload, std::size_t &offset, EntryType type, uint16_t serviceId, uint16_t instanceId, uint32_t ttl, uint8_t majorVersion)
Deserialize a entry payload.
Definition: service_entry.cpp:131
virtual bool ValidateOption(const option::Option *option) const noexcept override
Validate an option for adding.
Definition: service_entry.cpp:32
static std::unique_ptr< ServiceEntry > CreateOfferServiceEntry(uint16_t serviceId, uint16_t instanceId, uint8_t majorVersion, uint32_t minorVersion, uint32_t ttl=cInfiniteTtl)
Offer a service entry factory.
Definition: service_entry.cpp:84
static std::unique_ptr< ServiceEntry > CreateStopOfferEntry(uint16_t serviceId, uint16_t instanceId, uint8_t majorVersion, uint32_t minorVersion) noexcept
Stop offer a service entry factory.
Definition: service_entry.cpp:110
Communication message entry abstract option.
Definition: option.h:37
EntryType
Message entry type.
Definition: entry.h:19