summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--provider/posts/thermoprint-1.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/provider/posts/thermoprint-1.md b/provider/posts/thermoprint-1.md
new file mode 100644
index 0000000..bd98b71
--- /dev/null
+++ b/provider/posts/thermoprint-1.md
@@ -0,0 +1,80 @@
1---
2title: On the Architecture of a tool-set for interacting with character-oriented printers
3published: 2015-12-25
4tags: Thermoprint
5---
6
7# Motivation
8
9Some time ago I bought a cheap Chinese
10[thermoprinter](https://en.wikipedia.org/wiki/Thermal_printing) off eBay.
11As expected the printers firmware is really awkward to use (including binary
12control codes used to switch between char sets such as bold, italic, underlined,
13etc.).
14The obvious solution was to write a library to parse a more sensible
15representation and send it to be printed.
16
17Since there might, at some point, be other users wanting to print to my
18acquisition the architecture is intended to be present a somewhat usable
19interface to the uninitiated.
20
21# Implementation
22
23## Location
24
25Recently I created a new branch in
26[thermoprint](git://git.yggdrasil.li/thermoprint) called
27[rewrite](git://git.yggdrasil.li/thermoprint#rewrite).
28
29## Architecture Overview
30
31The new macroscopic architecture I´m currently aiming for is quite similar to
32the old one:
33
34 * A server intended to run on the machine connected to my cheap printer talking
35 directly to the printer on one end and serving a
36 [json api](https://hackage.haskell.org/package/servant) on the other.
37 * A (hopefully) tiny cli tool for debugging and personal use.
38 * A website (it will probably end up being based on
39 [yesod](https://hackage.haskell.org/package/yesod)) presenting a web interface
40 similar to the cli tool.
41
42## Features
43
44Features I intend to implement include:
45
46 * A parser for a bbcode-dialect which should be used in both the cli tool and the
47 website (it will probably end up using
48 [attoparsec](https://hackage.haskell.org/package/attoparsec)) -- bbcode as
49 presented on [Wikipedia](https://en.wikipedia.org/wiki/BBCode) is a proper
50 superset of the feature-set of my cheap Chinese printer.
51 * Reasonable test coverage using
52 [QuickCheck](https://hackage.haskell.org/package/QuickCheck),
53 [HUnit](http://hackage.haskell.org/package/HUnit).
54
55 Automatic testing with [cabal](https://www.haskell.org/cabal/) facilitated by
56 [hspec](https://hackage.haskell.org/package/hspec).
57 * Support and server-side storage for drafts.
58 * The Website should provide some richer formats than bbcode which will
59 probably find inclusion in the payload datastructure such as lists,
60 checklists, tables, etc.
61
62 The cli-tool should be able to use these too (the input will probably end up
63 being json-formatted).
64
65## Work so far
66
67I already have a prototype.
68It's quite bug-ridden and has recently developed serious problems actually
69printing after working satisfactorily for a few weeks.
70
71It also does not include a web-interface and I am quite unsatisfied with the
72overall code quality.
73
74The [685 lines of code](http://cloc.sourceforge.net/) can be found in the
75[repo](git://git.yggdrasil.li/thermoprint#master) as well.
76
77<!-- LocalWords: Thermoprint thermoprint json api cli yesod bbcode attoparsec
78 -->
79<!-- LocalWords: superset QuickCheck HUnit hspec datastructure repo
80 -->