Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
DeviceDescription.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Frameworks_UPnP_DeviceDescription_h_
5#define _Stroika_Frameworks_UPnP_DeviceDescription_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
10#include "Stroika/Foundation/Common/Common.h"
11#include "Stroika/Foundation/Containers/Collection.h"
13#include "Stroika/Foundation/DataExchange/ObjectVariantMapper.h"
14#include "Stroika/Foundation/Execution/LazyInitialized.h"
17
18#include "Device.h"
19
20/*
21 * TODO:
22 * @todo Add image support
23 * @todo Add serviceList support
24 */
25
26namespace Stroika::Frameworks::UPnP {
27
28 using namespace Stroika::Foundation;
29
33 using IO::Network::URI;
34
35 /**
36 * high level device description - from ssdp. This is the BASIC device info
37 * which appears to the XML file (pointed to by Device location field).
38 *
39 * This is based on http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf, page 43-46 apx
40 */
42 optional<URI> fPresentationURL;
43 String fDeviceType; // http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf - <deviceType> - Page 44
44 String fManufactureName;
45 String fFriendlyName;
46 optional<URI> fManufacturingURL;
47 optional<String> fModelDescription;
48 String fModelName;
49 optional<String> fModelNumber;
50 optional<URI> fModelURL;
51 optional<String> fSerialNumber;
52 /**
53 * Unique Device Name. Universally-unique identifier for the device, whether root or embedded.
54 * MUST be the same over time for a specific device instance (i.e., MUST survive reboots).MUST match the
55 * field value of the NT header field in device discovery messages.MUST match the prefix of the USN
56 * header field in all discovery messages.
57 */
59
60 /*
61 * OPTIONAL. Universal Product Code. 12-digit, all-numeric code that identifies the consumer package.
62 * Managed by the Uniform Code Council. Specified by UPnP vendor. Single UPC.
63 */
64 optional<String> fUPC;
65
66 /**
67 * @todo made several fields optional - so Icon default constructible - but according to
68 * https://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf these sb required (so not optional).
69 * @todo FIX
70 */
71 struct Icon {
72 InternetMediaType fMimeType{};
73 uint16_t fHorizontalPixels{16};
74 uint16_t fVerticalPixels{16};
75 uint16_t fColorDepth{8};
76 URI fURL{}; // url to the icon image file
77
78 /**
79 * @see Characters::ToString ();
80 */
81 nonvirtual String ToString () const;
82 };
83 optional<Collection<Icon>> fIcons;
84
85 /**
86 */
87 struct Service {
88 String fServiceType; // e.g. urn:schemas-upnp-org:service:serviceType:v
89 String fServiceID; // e.g. urn:upnp-org:serviceId:serviceID
90 URI fSCPDURL; // URL to service description
91 URI fControlURL; // URL to service description
92 URI fEventSubURL; // URL to service description
93
94 /**
95 * @see Characters::ToString ();
96 */
97 nonvirtual String ToString () const;
98 };
99 optional<Collection<Service>> fServices;
100
101 DeviceDescription () = default;
102
103 /**
104 * Mapper to facilitate serialization
105 */
107
108 /**
109 * @see Characters::ToString ();
110 */
111 nonvirtual String ToString () const;
112
113 private:
115 };
117
118 /**
119 */
120 Memory::BLOB Serialize (const DeviceDescription& dd);
121
122 /**
123 */
124 DeviceDescription DeSerialize (const Memory::BLOB& b);
125
126}
127
128/*
129 ********************************************************************************
130 ***************************** Implementation Details ***************************
131 ********************************************************************************
132 */
133#include "DeviceDescription.inl"
134
135#endif /*_Stroika_Frameworks_UPnP_DeviceDescription_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
A Collection<T> is a container to manage an un-ordered collection of items, without equality defined ...
Definition Collection.h:102
ObjectVariantMapper can be used to map C++ types to and from variant-union types, which can be transp...
value-object, where the value construction is delayed until first needed (can be handy to avoid c++ i...
static const Foundation::Execution::LazyInitialized< Foundation::DataExchange::ObjectVariantMapper > kMapper