Fledge
An open source edge computing platform for industrial users
south_api.h
1 #ifndef _SOUTH_API_H
2 #define _SOUTH_API_H
3 /*
4  * Fledge storage service.
5  *
6  * Copyright (c) 2021 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch, Massimiliano Pinto
11  */
12 #include <logger.h>
13 #include <server_http.hpp>
14 
15 #define SETPOINT "^/fledge/south/setpoint$"
16 #define OPERATION "^/fledge/south/operation$"
17 
18 class SouthService;
19 
20 class SouthApi {
21  public:
23  ~SouthApi();
24  unsigned short getListenerPort();
25  void setPoint(std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Response> response,
26  std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Request> request);
27  void operation(std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Response> response,
28  std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Request> request);
29  void startServer();
30 
31  private:
32  SimpleWeb::Server<SimpleWeb::HTTP>
33  *m_server;
34  SouthService *m_service;
35  std::thread *m_thread;
36  Logger *m_logger;
37 };
38 
39 #endif
Fledge Logger class used to log to syslog.
Definition: logger.h:26
void operation(std::shared_ptr< SimpleWeb::Server< SimpleWeb::HTTP >::Response > response, std::shared_ptr< SimpleWeb::Server< SimpleWeb::HTTP >::Request > request)
Invoke an operation on the south plugin.
Definition: south_api.cpp:188
Definition: south_api.h:20
void setPoint(std::shared_ptr< SimpleWeb::Server< SimpleWeb::HTTP >::Response > response, std::shared_ptr< SimpleWeb::Server< SimpleWeb::HTTP >::Request > request)
Implement the setPoint PUT request.
Definition: south_api.cpp:123
unsigned short getListenerPort()
Return the port the service is listening on.
Definition: south_api.cpp:107
The SouthService class.
Definition: south_service.h:46
void startServer()
Called on the API service thread.
Definition: south_api.cpp:99
~SouthApi()
Destroy the API.
Definition: south_api.cpp:84
SouthApi(SouthService *)
South API class constructor.
Definition: south_api.cpp:58