[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cash2ecash] branch master updated: added draft of serial configuration
From: |
gnunet |
Subject: |
[cash2ecash] branch master updated: added draft of serial configuration |
Date: |
Mon, 16 Dec 2024 16:43:52 +0100 |
This is an automated email from the git hooks/post-receive script.
manuel-geissbuehler pushed a commit to branch master
in repository cash2ecash.
The following commit(s) were added to refs/heads/master by this push:
new 45e84c1 added draft of serial configuration
45e84c1 is described below
commit 45e84c1875551b19c0d6839a528c941720769f4f
Author: Manuel Geissbühler <manuel@debian>
AuthorDate: Mon Dec 16 16:40:25 2024 +0100
added draft of serial configuration
---
.gitignore | 6 ++++++
.gitmodules | 3 +++
CMakeLists.txt | 0
cash2ecash.cpp | 37 ++++++++++++++++++++++++++++++++++++
src/cashacceptor/cashacceptor.cpp | 0
src/cashacceptor/cashacceptor.hpp | 40 +++++++++++++++++++++++++++++++++++++++
src/cashacceptor/dg600f.cpp | 40 +++++++++++++++++++++++++++++++++++++++
src/cashacceptor/dg600f.hpp | 38 +++++++++++++++++++++++++++++++++++++
src/extern/lvgl | 1 +
9 files changed, 165 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b80e712
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*.[oa]
+*~
+.*/
+CMakeFiles/
+*.png
+*.cmake
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..d69aade
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/extern/lvgl"]
+ path = src/extern/lvgl
+ url = https://github.com/lvgl/lvgl.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..e69de29
diff --git a/cash2ecash.cpp b/cash2ecash.cpp
new file mode 100644
index 0000000..6c66e7e
--- /dev/null
+++ b/cash2ecash.cpp
@@ -0,0 +1,37 @@
+// This is the main function for the cash2ecash program
+
+#include <cstdio>
+#include <iostream>
+#include <ostream>
+
+
+// Global Definitions
+enum state_e { INIT, SLEEP, IDLE, CONNECTION, ACCEPTCASH, CONFIRMATION, DONE };
+enum state_e state = INIT;
+
+
+
+int main(int argc, char *argv[]){
+ std::cout << "The Program is running" <<std::endl;
+
+ switch (state) {
+ case INIT:
+ break;
+ case SLEEP:
+ break;
+ case IDLE:
+ break;
+ case CONNECTION:
+ break;
+ case ACCEPTCASH:
+ break;
+ case CONFIRMATION:
+ break;
+ case DONE:
+ break;
+ default:
+ std::cout << "ERROR: unhandeled state" << std::endl;
+ break;
+ }
+
+}
diff --git a/src/cashacceptor/cashacceptor.cpp
b/src/cashacceptor/cashacceptor.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/src/cashacceptor/cashacceptor.hpp
b/src/cashacceptor/cashacceptor.hpp
new file mode 100644
index 0000000..0abae8f
--- /dev/null
+++ b/src/cashacceptor/cashacceptor.hpp
@@ -0,0 +1,40 @@
+#ifndef CASHACCEPTOR_H
+#define CASHACCEPTOR_H
+
+extern "C" {
+#include <taler/taler_util.h>
+}
+
+#include <vector>
+
+
+
+class Cashaccepor
+{
+ private:
+
+
+ protected:
+ TALER_Amount accumulatedAmmount;
+ std::vector<TALER_Amount> amountFIFO;
+
+ public:
+ Cashaccepor(){};
+ virtual int clearAccumulatedAmount();
+ virtual int startMoneyAcceptance();
+ virtual int stopMoneyAcceptance();
+ virtual int readAccumulated(TALER_Amount *retval);
+ virtual int readFIFO(TALER_Amount *retval);
+
+
+};
+
+
+
+
+
+
+
+
+
+#endif //CASHACCEPTOR_H
diff --git a/src/cashacceptor/dg600f.cpp b/src/cashacceptor/dg600f.cpp
new file mode 100644
index 0000000..51454a4
--- /dev/null
+++ b/src/cashacceptor/dg600f.cpp
@@ -0,0 +1,40 @@
+
+
+#include "dg600f.hpp"
+#include <termios.h>
+
+int DG600F::configSerial(int fd, int baudrate){
+ struct termios t;
+ if (tcgetattr(fd, &t) != 0){
+ std::cerr << "Error from tcgattr: " << strerror(errno) << std::endl;
+ return -1;
+ }
+
+
+ cfsetispeed(&t, baudrate);
+
+ t.c_cflag = (t.c_cflag & ~CSIZE) | CS8; //Configure 8 databits
+ t.c_iflag = t.c_iflag &= ~IGNBRK; //Disable break processing
+ t.c_lflag = 0; //no signaling chars, no echo, no canonical processing
+ t.c_cc[VMIN] = 0; //set minimum character for noncanonical read to 0
+ t.c_cc[VTIME] = 1; //Set read timeout for noncanonical read to 0.1 seconds
+ t.c_iflag = ~(IXON | IXOFF| IXANY); // shut off xon/xoff ctrl
+ t.c_cflag |= (CLOCAL | CREAD); // ignore modem controls enable reading
+ t.c_cflag |= PARENB; //enable parity
+ t.c_cflag &= ~PARODD; //set parity to even
+ t.c_cflag &= ~CSTOPB; //disable two stop bits
+
+ if (tcsetattr(fd, TCSANOW, &t) != 0) {
+ std::cerr << "Error from tcsetattr: " << strerror(errno)
+ << std::endl;
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+
+
+
diff --git a/src/cashacceptor/dg600f.hpp b/src/cashacceptor/dg600f.hpp
new file mode 100644
index 0000000..42c6410
--- /dev/null
+++ b/src/cashacceptor/dg600f.hpp
@@ -0,0 +1,38 @@
+#ifndef DG600F_H
+#define DG600F_H
+
+#include <cstdlib>
+#include <cstring>
+#include <errno.h>
+#include <fcntl.h>
+#include <iostream>
+#include <termios.h>
+#include <unistd.h>
+
+extern "C" {
+#include <taler/taler_util.h>
+}
+
+#include "cashacceptor.hpp"
+
+
+class DG600F : public Cashaccepor {
+private:
+ char *portPath;
+
+ int configSerial(int fd, int baudrate);
+
+
+
+protected:
+
+public:
+ DG600F(char * serialPortPath) : Cashaccepor(){};
+
+
+
+
+
+};
+
+#endif //DG600F_H
diff --git a/src/extern/lvgl b/src/extern/lvgl
new file mode 160000
index 0000000..6decbb7
--- /dev/null
+++ b/src/extern/lvgl
@@ -0,0 +1 @@
+Subproject commit 6decbb7f7783f6e48d4591fcb9f7810c2fb08e61
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cash2ecash] branch master updated: added draft of serial configuration,
gnunet <=