Skip to content

Commit

Permalink
Added transport field to protobuf schema
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Sep 12, 2018
1 parent 6844146 commit 8693f7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions NetworkedJtagInterface.cpp
Expand Up @@ -120,6 +120,7 @@ void NetworkedJtagInterface::Connect(const string& server, uint16_t port)
auto h = packet.mutable_hello();
h->set_magic("JTAGHAL");
h->set_version(1);
h->set_transport(Hello::TRANSPORT_JTAG);
if(!SendMessage(m_socket, packet))
{
throw JtagExceptionWrapper(
Expand All @@ -142,6 +143,14 @@ void NetworkedJtagInterface::Connect(const string& server, uint16_t port)
"");
}

//Make sure the server is JTAG
if(sh.transport() != Hello::TRANSPORT_JTAG)
{
throw JtagExceptionWrapper(
"Tried to connect to server as JTAG, but the server is using a different transport protocol",
"");
}

//All good, query the GPIO stats
if(IsGPIOCapable())
{
Expand Down
7 changes: 7 additions & 0 deletions jtaghal-net.proto
Expand Up @@ -8,6 +8,13 @@ message Hello
{
string magic = 1; //always "JTAGHAL"
uint32 version = 2; //always 1 for now
enum TransportType
{
TRANSPORT_JTAG = 0;
TRANSPORT_SWD = 1;
};

TransportType transport = 3;
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 8693f7e

Please sign in to comment.