diff options
-rw-r--r-- | provider/posts/thermoprint-1.md | 80 |
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 | --- | ||
2 | title: On the Architecture of a tool-set for interacting with character-oriented printers | ||
3 | published: 2015-12-25 | ||
4 | tags: Thermoprint | ||
5 | --- | ||
6 | |||
7 | # Motivation | ||
8 | |||
9 | Some time ago I bought a cheap Chinese | ||
10 | [thermoprinter](https://en.wikipedia.org/wiki/Thermal_printing) off eBay. | ||
11 | As expected the printers firmware is really awkward to use (including binary | ||
12 | control codes used to switch between char sets such as bold, italic, underlined, | ||
13 | etc.). | ||
14 | The obvious solution was to write a library to parse a more sensible | ||
15 | representation and send it to be printed. | ||
16 | |||
17 | Since there might, at some point, be other users wanting to print to my | ||
18 | acquisition the architecture is intended to be present a somewhat usable | ||
19 | interface to the uninitiated. | ||
20 | |||
21 | # Implementation | ||
22 | |||
23 | ## Location | ||
24 | |||
25 | Recently 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 | |||
31 | The new macroscopic architecture I´m currently aiming for is quite similar to | ||
32 | the 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 | |||
44 | Features 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 | |||
67 | I already have a prototype. | ||
68 | It's quite bug-ridden and has recently developed serious problems actually | ||
69 | printing after working satisfactorily for a few weeks. | ||
70 | |||
71 | It also does not include a web-interface and I am quite unsatisfied with the | ||
72 | overall code quality. | ||
73 | |||
74 | The [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 | --> | ||