TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
Loading...
Searching...
No Matches
Interfaces.h
Go to the documentation of this file.
1#pragma once
11#include <stdint.h>
12
13#include "Logger.h"
14
15namespace twd {
16
24 public:
25 virtual ~FrameReceiver() = default;
27 virtual void onFrame(const uint8_t* frame, uint16_t len) = 0;
28};
29
38 public:
39 virtual ~UsbTransport() = default;
41 virtual bool begin(const char* productName) = 0;
43 virtual bool ready() = 0;
45 virtual bool send(const uint8_t* frame, uint16_t len) = 0;
47 virtual void setReceiver(FrameReceiver* receiver) = 0;
50 virtual void setHostMac(const uint8_t mac[6]) = 0;
51};
52
59class Uplink {
60 public:
61 virtual ~Uplink() = default;
63 virtual bool begin(const char* ssid, const char* password) = 0;
65 virtual bool connected() = 0;
66};
67
76class FrameLink {
77 public:
78 virtual ~FrameLink() = default;
80 virtual bool sendFrame(const uint8_t* frame, uint16_t len) = 0;
82 virtual void setFrameReceiver(FrameReceiver* receiver) = 0;
84 virtual const uint8_t* macAddress() = 0;
85};
86
87} // namespace twd
Printf-style logging through the global TWD_LOGGER object.
Consumer of Ethernet frames.
Definition Interfaces.h:23
virtual void onFrame(const uint8_t *frame, uint16_t len)=0
The frame is only valid during the call; copy it if it must be kept.
virtual ~FrameReceiver()=default
Moves Ethernet frames between the MCU and the USB host.
Definition Interfaces.h:37
virtual bool begin(const char *productName)=0
Registers the USB network interface (before the USB stack is started).
virtual void setReceiver(FrameReceiver *receiver)=0
Frames coming from the host are passed to receiver.
virtual bool send(const uint8_t *frame, uint16_t len)=0
Queues a frame for the host. Never blocks; false if it was dropped.
virtual void setHostMac(const uint8_t mac[6])=0
virtual bool ready()=0
The host has enumerated and configured the device.
virtual ~UsbTransport()=default