Fledge
An open source edge computing platform for industrial users
north_api.h
1 #ifndef _NORTH_API_H
2 #define _NORTH_API_H
3 /*
4  * Fledge north service API.
5  *
6  * Copyright (c) 2025 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 #include <logger.h>
13 #include <server_http.hpp>
14 
15 // Debugger URLs
16 #define DEBUG_ATTACH "^/fledge/north/debug/attach$"
17 #define DEBUG_DETACH "^/fledge/north/debug/detach$"
18 #define DEBUG_BUFFER "^/fledge/north/debug/buffer$"
19 #define DEBUG_ISOLATE "^/fledge/north/debug/isolate$"
20 #define DEBUG_SUSPEND "^/fledge/north/debug/suspend$"
21 #define DEBUG_STEP "^/fledge/north/debug/step$"
22 #define DEBUG_REPLAY "^/fledge/north/debug/replay$"
23 #define DEBUG_STATE "^/fledge/north/debug/state$"
24 
25 class NorthService;
26 
27 typedef std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Response> Response;
28 typedef std::shared_ptr<SimpleWeb::Server<SimpleWeb::HTTP>::Request> Request;
29 
30 class NorthApi {
31  public:
33  ~NorthApi();
34  unsigned short getListenerPort();
35  void startServer();
36 
37  // Debugger entry points
38  void attachDebugger(Response response, Request request);
39  void detachDebugger(Response response, Request request);
40  void setDebuggerBuffer(Response response, Request request);
41  void getDebuggerBuffer(Response response, Request request);
42  void isolateDebugger(Response response, Request request);
43  void suspendDebugger(Response response, Request request);
44  void stepDebugger(Response response, Request request);
45  void replayDebugger(Response response, Request request);
46  void stateDebugger(Response response, Request request);
47 
48  private:
49  SimpleWeb::Server<SimpleWeb::HTTP>
50  *m_server;
51  NorthService *m_service;
52  std::thread *m_thread;
53  Logger *m_logger;
54 };
55 
56 #endif
NorthApi::replayDebugger
void replayDebugger(Response response, Request request)
Invoke debugger replay on the north plugin.
Definition: north_api.cpp:535
NorthApi::getDebuggerBuffer
void getDebuggerBuffer(Response response, Request request)
Invoke get debugger buffer size on the north plugin.
Definition: north_api.cpp:319
NorthApi::startServer
void startServer()
Called on the API service thread.
Definition: north_api.cpp:182
NorthApi::stepDebugger
void stepDebugger(Response response, Request request)
Invoke set debugger step command on the north plugin.
Definition: north_api.cpp:478
NorthApi::getListenerPort
unsigned short getListenerPort()
Return the port the service is listening on.
Definition: north_api.cpp:190
NorthApi::isolateDebugger
void isolateDebugger(Response response, Request request)
Invoke isolate debugger handler on the north plugin.
Definition: north_api.cpp:346
NorthApi::stateDebugger
void stateDebugger(Response response, Request request)
Invoke debugger state on the north plugin.
Definition: north_api.cpp:565
NorthApi::detachDebugger
void detachDebugger(Response response, Request request)
Invoke debugger detach on the north plugin.
Definition: north_api.cpp:234
NorthApi::attachDebugger
void attachDebugger(Response response, Request request)
Invoke debugger attach on the north plugin.
Definition: north_api.cpp:205
NorthApi::suspendDebugger
void suspendDebugger(Response response, Request request)
Invoke suspend debugger handler on the north plugin.
Definition: north_api.cpp:412
NorthApi
Definition: north_api.h:30
Logger
Fledge Logger class used to log to syslog.
Definition: logger.h:42
NorthApi::setDebuggerBuffer
void setDebuggerBuffer(Response response, Request request)
Invoke set debugger buffer size on the north plugin.
Definition: north_api.cpp:262
NorthService
The NorthService class.
Definition: north_service.h:42
NorthApi::~NorthApi
~NorthApi()
Destroy the API.
Definition: north_api.cpp:167
NorthApi::NorthApi
NorthApi(NorthService *)
North API class constructor.
Definition: north_api.cpp:140