KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_client.h
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef KICAD_API_CLIENT_H
21
#define KICAD_API_CLIENT_H
22
23
#include <string>
24
#include <nng/nng.h>
25
#include <nng/protocol/reqrep0/req.h>
26
#include <wx/string.h>
27
28
#include <google/protobuf/message.h>
29
30
#include <
kicommon.h
>
31
#include <api/common/envelope.pb.h>
32
33
34
class
KICOMMON_API
KICAD_API_CLIENT
35
{
36
public
:
37
explicit
KICAD_API_CLIENT
(
int
aTimeoutMs = 1000,
bool
aBlock =
true
);
38
~KICAD_API_CLIENT
();
39
40
bool
Connect
(
const
wxString& aSocketUrl );
41
void
Disconnect
();
42
43
bool
IsConnected
()
const
{
return
m_isOpen
&&
m_isConnected
; }
44
53
bool
Send(
const
google::protobuf::Message& aRequest, kiapi::common::ApiResponse& aResponse,
54
const
std::string& aClientName =
"kicad"
);
55
56
const
wxString&
GetLastError
()
const
{
return
m_lastError
; }
57
58
private
:
59
nng_socket
m_socket
;
60
bool
m_isOpen
;
61
bool
m_isConnected
;
62
wxString
m_lastError
;
63
bool
m_block
;
64
};
65
66
67
#endif
// KICAD_API_CLIENT_H
KICAD_API_CLIENT::Disconnect
void Disconnect()
Definition
api_client.cpp:78
KICAD_API_CLIENT::m_isConnected
bool m_isConnected
Definition
api_client.h:61
KICAD_API_CLIENT::KICAD_API_CLIENT
KICAD_API_CLIENT(int aTimeoutMs=1000, bool aBlock=true)
Definition
api_client.cpp:29
KICAD_API_CLIENT::m_block
bool m_block
Definition
api_client.h:63
KICAD_API_CLIENT::GetLastError
const wxString & GetLastError() const
Definition
api_client.h:56
KICAD_API_CLIENT::m_lastError
wxString m_lastError
Definition
api_client.h:62
KICAD_API_CLIENT::Connect
bool Connect(const wxString &aSocketUrl)
Definition
api_client.cpp:57
KICAD_API_CLIENT::m_socket
nng_socket m_socket
Definition
api_client.h:59
KICAD_API_CLIENT::m_isOpen
bool m_isOpen
Definition
api_client.h:60
KICAD_API_CLIENT::IsConnected
bool IsConnected() const
Definition
api_client.h:43
kicommon.h
KICOMMON_API
#define KICOMMON_API
Definition
kicommon.h:27
src
include
api
api_client.h
Generated on Thu Sep 17 2026 00:06:16 for KiCad PCB EDA Suite by
1.13.2