Skip to content

Commit

Permalink
Added support for automatic reconnection of raw-uart connection
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinert committed Aug 17, 2020
1 parent 3b7adc6 commit 53c63f0
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 220 deletions.
17 changes: 9 additions & 8 deletions include/rawuartudplistener.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
/*
* rawuartudplistener.h is part of the HB-RF-ETH firmware - https://github.com/alexreinert/HB-RF-ETH
*
*
* Copyright 2020 Alexander Reinert
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -27,21 +27,22 @@
#include "radiomoduleconnector.h"

class RawUartUdpListener : FrameHandler {
private:
private:
RadioModuleConnector* _radioModuleConnector;
std::atomic<uint> _remoteAddress;
std::atomic<ushort> _remotePort;
std::atomic<bool> _connectionStarted;
std::atomic<int> _counter;
std::atomic<int> _endpointConnectionIdentifier;
uint64_t _lastReceivedKeepAlive;
udp_pcb* _pcb;
QueueHandle_t _udp_queue;
TaskHandle_t _tHandle = NULL;

void handlePacket(pbuf *pb, ip4_addr_t addr, uint16_t port);
void sendMessage(unsigned char command, unsigned char* buffer, size_t len);
public:

public:
RawUartUdpListener(RadioModuleConnector* radioModuleConnector);

void handleFrame(unsigned char* buffer, uint16_t len);
Expand Down
Loading

0 comments on commit 53c63f0

Please sign in to comment.