SIde-Channel Analysis toolKit (SICAK)
Software toolkit for side-channel analysis
chardevice.h
Go to the documentation of this file.
1 /*
2 * SICAK - SIde-Channel Analysis toolKit
3 * Copyright (C) 2018 Petr Socha, FIT, CTU in Prague
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 
29 #ifndef CHARDEVICE_H
30 #define CHARDEVICE_H
31 
32 #include <QString>
33 #include "types_basic.hpp"
34 
42 class CharDevice {
43 
44 public:
45 
46  virtual ~CharDevice() {}
47 
49  virtual QString getPluginName() = 0;
51  virtual QString getPluginInfo() = 0;
52 
54  virtual void init(const char * filename, int baudrate = 9600, int parity = 0, int stopBits = 1) = 0;
56  virtual void deInit() = 0;
57 
59  virtual QString queryDevices() = 0;
60 
62  virtual void setTimeout(int ms = 5000) = 0;
63 
65  virtual size_t send(const VectorType<uint8_t> & data) = 0;
67  virtual size_t receive(VectorType<uint8_t> & data) = 0;
68 
70  virtual size_t send(const VectorType<uint8_t> & data, size_t len) = 0;
72  virtual size_t receive(VectorType<uint8_t> & data, size_t len) = 0;
73 
75  virtual size_t send(const uint8_t * buffer, size_t len) = 0;
77  virtual size_t receive(uint8_t * buffer, size_t len) = 0;
78 
79 };
80 
81 #define CharDevice_iid "cz.cvut.fit.Sicak.CharDeviceInterface/1.0"
82 
83 Q_DECLARE_INTERFACE(CharDevice, CharDevice_iid)
84 
85 
86 #endif /* CHARDEVICE_H */
Character device QT plugin interface.
Definition: chardevice.h:42
virtual void setTimeout(int ms=5000)=0
Set communication timeout of the character device, in milliseconds, default 5s.
virtual void init(const char *filename, int baudrate=9600, int parity=0, int stopBits=1)=0
Initialize the plugin with device given by filename, parity: 0=none,1=odd,2=even.
virtual QString getPluginName()=0
Plugin name.
This header file contains class templates of basic data containers.
virtual void deInit()=0
Deinitialize the plugin.
virtual size_t send(const VectorType< uint8_t > &data)=0
Sends out the VectorType.
virtual size_t receive(VectorType< uint8_t > &data)=0
Fills the given VectorType.
virtual QString queryDevices()=0
Query available devices/filenames.
virtual QString getPluginInfo()=0
Plugin info.