ServiceControl.h
Go to the documentation of this file.
1 /****
2  * ServiceControl.h
3  *
4  * Copyright 2020 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming UPnP Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  ****/
19 
20 #pragma once
21 
22 #include "Service.h"
23 #include <Data/CString.h>
24 #include <memory>
25 
26 namespace UPnP
27 {
28 class DeviceControl;
29 
30 class ServiceControl : public Service
31 {
32 public:
36 
37  struct Description {
41  };
42 
43  ServiceControl() = delete;
44  ServiceControl(const ServiceControl&) = delete;
45 
47  {
48  }
49 
54  {
55  return reinterpret_cast<DeviceControl&>(Service::root());
56  }
57 
58  const DeviceControl& root() const
59  {
60  return const_cast<ServiceControl*>(this)->root();
61  }
62 
63  String getField(Field desc) const override;
64 
66  {
67  return reinterpret_cast<ServiceControl*>(next());
68  }
69 
70  bool sendRequest(HttpRequest* request) const override;
71 
73  {
74  return Error::ActionNotImplemented;
75  }
76 
80  bool configure(const XML::Node* service);
81 
83  {
84  return reinterpret_cast<DeviceControl&>(Service::device());
85  }
86 
91  {
92  return description_;
93  }
94 
95 private:
96  Description description_;
97 };
98 
99 } // namespace UPnP
Class to manage a NUL-terminated C-style string When storing persistent strings in RAM the regular St...
Definition: CString.h:27
Encapsulates an incoming or outgoing request.
Definition: HttpRequest.h:37
The String class.
Definition: WString.h:137
Definition: ActionRequest.h:27
Definition: DeviceControl.h:32
Represents any kind of device, including a root device.
Definition: Libraries/UPnP/src/include/Network/UPnP/Device.h:58
Item * next() const override
Definition: LinkedItem.h:34
Class template for singly-linked list of objects.
Definition: ObjectList.h:32
Definition: ServiceControl.h:31
ServiceControl * getNext() const
Definition: ServiceControl.h:65
String getField(Field desc) const override
ServiceControl(const ServiceControl &)=delete
DeviceControl & device() const
Definition: ServiceControl.h:82
const DeviceControl & root() const
Definition: ServiceControl.h:58
const Description & description()
Get service description.
Definition: ServiceControl.h:90
bool configure(const XML::Node *service)
Called during initialisation to configure this object.
Error handleAction(ActionRequest &req) override
An action request has been received.
Definition: ServiceControl.h:72
DeviceControl & root()
Get the root device.
Definition: ServiceControl.h:53
ServiceControl(DeviceControl &device)
Definition: ServiceControl.h:46
bool sendRequest(HttpRequest *request) const override
Implemented in ServiceControl.
Represents any kind of device, including a root device.
Definition: UPnP/src/include/Network/UPnP/Service.h:47
Device & root()
Field
Definition: UPnP/src/include/Network/UPnP/Service.h:49
Device & device() const
Definition: UPnP/src/include/Network/UPnP/Service.h:97
Definition: ActionRequest.h:25
Error
Definition: Libraries/UPnP/src/include/Network/UPnP/Error.h:45
rapidxml::xml_node< char > Node
Definition: RapidXML.h:37
Definition: ServiceControl.h:37
CString serviceId
Definition: ServiceControl.h:40
CString eventSubURL
Definition: ServiceControl.h:39
CString controlURL
Definition: ServiceControl.h:38