liv

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 2 Imported by: 0

README

LocalInventoryWatcher

Organize your local inventory, keep track of what you have on your shelves and cupboards. LIV utilizes a barcode scanner to scan products and allows you to add or remove them from your inventory or add them your Bring shopping list.

Configuration

The server and hmi applications are configured by providing a ".env"-configuration file.

Server

The server applications connects to a MySQL-Database, hosts the ReactJS frontend and a API, handles input from a barcode scanner

dbUser=<Username for database access>
dbPassword=<Password for database access>
dbName=<Database name>
dbHost=<Hostname of database>

scannerActive=<If true activates barcode scanner handling>
scannerDeviceId=<deviceId for barcodescanner>

openGTINEnabled=<if true activates openGTIN EAN-product resolver>
openGTINAPIKey=<API Key for openGTIN API which is used for EAN code resolving>

serverPort=<Port which is used for frontend/api server>

bringEmail=<EMail for Bring authentication>
bringPassword=<Password for Bring authentication>

hmiServer=<Address for hmi server>
hmiServerPort=<Port for hmi server>
HMI

The HMI application opens a gRPC-server which is used to receive display commands from the main application.

port=<Port which is used for hmi server>
Build

The WS2811b library uses cgo to compile, so its not easily possible to cross compile from a non-arm system, thus a docker image is used to compile the application. The Image file can be found at: hmi/Dockerfile. Original Source

To compile the application used the following command:

docker run --rm -ti -v "$(pwd)":/go/src/home rpi-ws281x-go-builder /bin/sh -c "go build -o /go/src/home/hmi/hmi -v /go/src/home/hmi/main.go"

docker run --rm -ti -v "$(pwd)":/go/src/home rpi-ws281x-go-builder /bin/sh -c "go build -o /go/src/home/hmi/grpc/client -v /go/src/home/hmi/grpc/client/main.go"

check file with 'file '

Requirements

  1. A MariaDB/MySQL server (see schema.sql for the db schema)
  2. A unix-System which runs the server application (tested with Raspbian)
  3. A RPi whichs runs the HMI application
Hardware

LIV was developed to run on a RaspberryPi which has a WS2811b LED strip wired to it.

TODOs

  • externalize scanner to standalone application - communicate between applications by gRPC (this would allow the server to run on any go supported system)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
backend
api
File: helpers.go source: https://www.alexedwards.net/blog/how-to-properly-parse-a-json-request-body
File: helpers.go source: https://www.alexedwards.net/blog/how-to-properly-parse-a-json-request-body
app
bring
Bring package contains methods to manipulate bring shopping lists TODO implement config based login
Bring package contains methods to manipulate bring shopping lists TODO implement config based login
hdb
scanner
package scanner contains implementations for handling input events from a barcode&qr code scanner Package scanner provides functions for reading barcode scans from usb-connected barcode scanner devices as if they were keyboards, i.e., by using the corresponding '/dev/input/event' device, inspired by this post on linuxquestions.org: http://www.linuxquestions.org/questions/programming-9/read-from-a-usb-barcode-scanner-that-simulates-a-keyboard-495358/#post2767643 Also found important Go-specific information by reviewing the code from this repo on github: https://github.com/gvalkov/golang-evdev
package scanner contains implementations for handling input events from a barcode&qr code scanner Package scanner provides functions for reading barcode scans from usb-connected barcode scanner devices as if they were keyboards, i.e., by using the corresponding '/dev/input/event' device, inspired by this post on linuxquestions.org: http://www.linuxquestions.org/questions/programming-9/read-from-a-usb-barcode-scanner-that-simulates-a-keyboard-495358/#post2767643 Also found important Go-specific information by reviewing the code from this repo on github: https://github.com/gvalkov/golang-evdev
grpc module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL