This commit is contained in:
Ben Meadors
2023-01-22 08:49:06 -06:00
parent 4c9f0b2646
commit ac6d4e33d4
4 changed files with 153 additions and 212 deletions

View File

@@ -40,37 +40,37 @@
class XModemAdapter
{
public:
// Called when we put a fragment in the outgoing memory
Observable<uint32_t> packetReady;
public:
// Called when we put a fragment in the outgoing memory
Observable<uint32_t> packetReady;
XModemAdapter();
XModemAdapter();
void handlePacket(meshtastic_XModem xmodemPacket);
meshtastic_XModem getForPhone();
void handlePacket(meshtastic_XModem xmodemPacket);
meshtastic_XModem getForPhone();
private:
bool isReceiving = false;
bool isTransmitting = false;
bool isEOT = false;
private:
bool isReceiving = false;
bool isTransmitting = false;
bool isEOT = false;
int retrans = MAXRETRANS;
int retrans = MAXRETRANS;
uint16_t packetno = 0;
uint16_t packetno = 0;
#if defined(ARCH_NRF52)
File file = File(FSCom);
File file = File(FSCom);
#else
File file;
File file;
#endif
char filename[sizeof(meshtastic_XModem_buffer_t::bytes)] = {0};
char filename[sizeof(meshtastic_XModem_buffer_t::bytes)] = {0};
protected:
meshtastic_XModem xmodemStore = meshtastic_XModem_init_zero;
unsigned short crc16_ccitt(const pb_byte_t *buffer, int length);
int check(const pb_byte_t *buf, int sz, unsigned short tcrc);
void sendControl(meshtastic_XModem_Control c);
protected:
meshtastic_XModem xmodemStore = meshtastic_XModem_init_zero;
unsigned short crc16_ccitt(const pb_byte_t *buffer, int length);
int check(const pb_byte_t *buf, int sz, unsigned short tcrc);
void sendControl(meshtastic_XModem_Control c);
};
extern XModemAdapter xModem;