Ardour  9.2-266-g5d535d4cb7
mcp_http.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Frank Povazanj <frank.povazanj@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_surface_mcp_http_h_
20 #define _ardour_surface_mcp_http_h_
21 
22 #include <memory>
23 #include <stdint.h>
24 #include <string>
25 
27 
28 namespace PBD
29 {
30 class EventLoop;
31 }
32 
33 namespace ARDOUR
34 {
35 class Session;
36 }
37 
38 namespace ArdourSurface
39 {
40 
41 class MCPHttpServer;
42 
43 extern const char* const mcp_http_surface_name;
44 extern const char* const mcp_http_surface_id;
45 
47 {
48 public:
49  enum DebugLevel {
50  DebugOff = 0,
52  DebugVerbose = 2
53  };
54 
56  virtual ~MCPHttp ();
57 
58  XMLNode& get_state () const override;
59  int set_state (const XMLNode&, int version) override;
60 
61  bool has_editor () const override
62  {
63  return true;
64  }
65  void* get_gui () const override;
66  void tear_down_gui () override;
67 
68  int set_active (bool) override;
69  void stripable_selection_changed () override {}
70 
72 
73  void set_port (uint16_t);
74  uint16_t port () const
75  {
76  return _port;
77  }
78 
79  void set_debug_level (int);
80  int debug_level () const
81  {
82  return _debug_level;
83  }
84 
85  std::string endpoint_url () const;
86  std::string protocol_name () const;
87 
88 private:
89  int start ();
90  int stop ();
91  void build_gui ();
92 
93  std::unique_ptr<MCPHttpServer> _server;
94  uint16_t _port;
97  mutable void* _gui;
98 };
99 
100 } // namespace ArdourSurface
101 
102 #endif // _ardour_surface_mcp_http_h_
XMLNode & get_state() const override
int set_active(bool) override
uint16_t port() const
Definition: mcp_http.h:74
std::unique_ptr< MCPHttpServer > _server
Definition: mcp_http.h:93
std::string endpoint_url() const
ARDOUR::Session & ardour_session() const
void tear_down_gui() override
PBD::EventLoop * _event_loop
Definition: mcp_http.h:96
void * get_gui() const override
MCPHttp(ARDOUR::Session &)
int set_state(const XMLNode &, int version) override
int debug_level() const
Definition: mcp_http.h:80
std::string protocol_name() const
void stripable_selection_changed() override
Definition: mcp_http.h:69
void set_port(uint16_t)
bool has_editor() const override
Definition: mcp_http.h:61
Definition: xml++.h:114
const char *const mcp_http_surface_id
const char *const mcp_http_surface_name
DebugBits EventLoop
Definition: axis_view.h:42