1.2.3. EInk service - 1.0

EInk service contains function to work with hardware screens, displaying images, rendering and dithering.

1.2.3.1. Configuration

Some configuration may be defined on this service :

Environment variable

Description

Additional informations

SCREEN_WIDTH

screen width

if not specified, 3200 by default

SCREEN_HEIGHT

screen height

if not specified 1800 by default

SCREEN_DISPLAY_POSITION

display position (integer)

encoded values:
0 : Horizontal
1 : Horizontal flipped
2: Vertical
3: Vertical flipped

SCREEN_PALETTE

used palette (integer)

encoded values:
0 : 25 inch eink display

UNFITTED_IMAGE_DISPOSITION

in case the image does not properly fit in the screen, this define the position in the screen

0: TopLeft
1: Centered

BACKGROUND_COLOR

color background for images that are not fitting the whole screen (default to white)

EINK_DEVICE

Eink screen driver

0: T1000
1: T2000
2 :T2000 pipelined display as eink suggest

RQ : on cloud the given orientation is tooked : https://github.com/GHA-Group/e-tabelone/issues/122

Note , GPIO command, used for triggering the power on and off for the display. This can be configured on the command line.

Env Variable

description

GPIO_MODE

define the usage of gpio in the display

0 => no gpio, 1 => gpio activated

GPIO_PIN_NUMBER

mode 1 : gpio pin number

GPIO_DELAY_BEFORE

mode 1: gpio delay in ms to want before sending the display action

GPIO_DELAY_AFTER

mode 1 : gpio delay after the display to switch off the display using the gpio

1.2.3.2. Detailed commands

1.2.3.2.1. eink_display_draw

this function handle some image composition and additional drawing,

Parameter

Description

DRAWINGINSTRUCTION

this is a json encoded string containing the drawing commands

OUTPUTFile

the generated output file (in .eink file format)

Drawing instruction has the following structure :

{
  "base_eink_image": null,
  "empty_eink_image_configuration": {
    "width": 3200,
    "height": 1800
  },
  "instructions": []
}

instructions contains commands for drawing, these are described below

1.2.3.2.1.1. Drawing introduction

the encoded string start with a specific header telling if the drawing start from a file, or an empty white screen, with the proper width and height

one of the two base_eink_image or empty_eink_image_configuration property has to be populated.

1.2.3.2.1.2. Drawing instructions

in the instructions array, one can put several instructions to make images:

Drawing instruction

example

DrawText

draw a text at the specific location

{
“DrawText”: {
“text”: “Hello, world!”,
“color”: [
255,
0,
0
],
“x”: 300,
“y”: 0,
“font_size”: 35,
“width”: 500,
“height”: 35
}
},

DrawQrCode

draw a qrcode, at a specific location,

{
“DrawQrCode”: {
“qrcode”: “QRCode value”,
“x”: 300,
“y”: 400,
“width”: 100,
“height”: 100
}
}

DrawImage

draw a file at a specific location

DrawSvg

draw a svg content at a specific location

example :

{
  "base_eink_image": null,
  "empty_eink_image_configuration": {
    "width": 3200,
    "height": 1800
  },
  "instructions": [
    {
      "DrawText": {
        "text": "Hello, world!",
        "color": [
          255,
          0,
          0
        ],
        "x": 300,
        "y": 0,
        "font_size": 35,
        "width": 500,
        "height": 35
      }
    },
    {
      "DrawText": {
        "text": "Hello, world!",
        "color": [
          0,
          0,
          0
        ],
        "x": 300,
        "y": 700,
        "font_size": 35,
        "width": 500,
        "height": 35
      }
    },
    {
      "DrawQrCode": {
        "qrcode": "QRCode value",
        "x": 300,
        "y": 400,
        "width": 100,
        "height": 100
      }
    }
  ]
}

1.2.3.2.2. Sample for using the eink service using the admincli / admin_web commands

1.2.3.2.2.1. Redefine the screen orientation

Once the eink service is deployed, one can stop the service and reconfigure it, to change the orientation, for example :

stop_app('eink-1.0')
activate_app('eink-1.0', { "SCREEN_DISPLAY_POSITION":"2" })
start_app('eink-1.0')

this will configure the screen in a vertical position

To check if the new parameters are properly tooked, Go to the admin_web page, and look in the deployed_applications if the parameters are correctly positionned along the “eink” application