Uploading custom display images, file-system support#
Note
This feature is available from Visionect Software Suite 3.2 onward.
Uploading custom images
Uploading an image file to the Visionect client device. The function takes a base64 encoded PNG image and uploads it to the electronic paper sign. The server transforms the PNG image to the device image format before uploading it.
okular.SetImage(target, name, imageData)
- Parameters:
Target device UUID string.
The name parameter should be set to “disconnected”, as only changing the disconnected image is currently supported.
An imageData base64 encoded PNG image in the data URL string format
Returns: Promise, which is resolved ether with ‘Error’ or with the device file checksum string.
Example:
okular.SetImage(okular.device_uuid, "disconnected", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC").then(function(result) {
console.log(result); // Success: print uploaded checksum
}, function(err) {
console.log(err);
// Error: Maybe retry later.
});
Displaying a list of files on device
The API allows the user to list the files located on the device:
okular.ListFiles(target)
- Parameters:
Target device UUID string.
Returns: Promise, which is resolved ether with ‘Error’ or with the object, containing a file list in the following format:
{"filename1":{"checksum": string, "size": string }, "filename2":{"checksum": "...", size: "..." }, ... }
Example:
okular.ListFiles(target).then(function(result) {
console.log(result); // Success: stuff worked!
}, function(err) {
console.log(err);
// Error: Maybe retry later.
});
// Output: {"disconnected.pv2":{"checksum":"1960206407","size":"74975"}}