fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1/* 2* This file is part of HayBox 3* Copyright (C) 2024 Jonathan Haylett 4* 5* HayBox is free software: you can redistribute it and/or modify 6* it under the terms of the GNU General Public License version 3 as 7* published by the Free Software Foundation. 8* 9* This software is distributed in the hope that it will be useful, 10* but WITHOUT ANY WARRANTY; without even the implied warranty of 11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12* GNU General Public License for more details. 13* 14* You should have received a copy of the GNU General Public License 15* along with this software. If not, see <http://www.gnu.org/licenses/>. 16*/ 17 18#ifndef _COMMS_CONFIGURATORBACKEND_HPP 19#define _COMMS_CONFIGURATORBACKEND_HPP 20 21#include "cobs/Print.h" 22#include "cobs/Stream.h" 23#include "core/CommunicationBackend.hpp" 24 25#include <config.pb.h> 26 27class ConfiguratorBackend :public CommunicationBackend { 28public : 29ConfiguratorBackend ( 30InputState & inputs , 31InputSource ** input_sources , 32size_t input_source_count , 33Config & config , 34Stream & stream 35 ); 36CommunicationBackendId BackendId (); 37void SendReport (); 38 39private : 40size_t ReadPacket (uint8_t * buffer ,size_t max_len ); 41int ReadByte (); 42void SkipToNextPacket (); 43bool WritePacket (Command command_id ,uint8_t * buffer ,size_t len ); 44bool HandleUnknownCommand (Command command ); 45bool HandleGetDeviceInfo (); 46bool HandleGetConfig (); 47bool HandleSetConfig (); 48 49 packetio::COBSStream _in ; 50 packetio::COBSPrint _out ; 51Stream & _base_stream ; 52Config & _config ; 53}; 54 55#endif