Skip to content

App and resource management for smart mug writing in JavaScript

Notifications You must be signed in to change notification settings

zcpara/app_resource_management

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App and resource management for smart mug writing in JavaScript

readme

On the smart mug, there are many Apps running concurrently. This package supports process management, app context switch, device (Display and Touchpanel) management, Job management, notification, and default setting (similar as screen saver).

  • Led Screen: Only the main process of the front end app can access led screen and display image, only JPG and BMP files are supported now.
  • Touch Panel: Deliver the touch event only to the front end app.
  • App Switch: Create a process for each App, different Apps execute on different process not thread, determine which app is the front end app, save and restore context for App switch.
  • Notification: 1) Some Apps can register notification, when a new message comes, a notification will be displayed if the App is not the front end app at that time; 2) Signals from linux OS, voice recogonition engine, motion sensor engine and other can trigger notification in order to launch an App immediately.

Quick Start

  1. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/app_manager_mug_client/node_modules/node-canvas-lib:$HOME/app_manager_mug_client/main/highLevelAPI/linux-convert
  2. node $HOME/app_manager_mug_client/main/main.js

High leve API Example

display image

var io = require('../../main/highLevelAPI/io.js');
io.disp_N(['a.png', 'b.png'], 2, 100);

create an app

var sys = require('../../main/highLevelAPI/sys.js');
sys.newApp('a.js');

touch event handler

io.touchPanel.on('touchEvent', function(e, x, y, id) {
console.log(e);
});
io.touchPanel.on('gesture', function(gesture) {
console.log(gesture);
});

convert English and Chinese text to images fit to smart mug

io.text2Img(text, color, function(image) {
var animation = [];
for (var i=0; i<image.numberOfImg; i++) {
animation.concat(image['img'+i]);
}
io.disp_raw_N(animation, image.numberOfImg, 100);
});

register notification

sys.registerNotification(icon, app)

For more details, please reference main/highLevelAPI/io.js and main/highLevelAPI/sys.js.

File

  • main: app and resource manager, the mini OS
  • app: all Apps running on the smart mug
  • config.json: mug configuration
  • img2json.js: a tool to convert images to media.json

Contact

Copyright and license

The Apache 2.0 license.

About

App and resource management for smart mug writing in JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 39.1%
  • HTML 31.9%
  • C 25.3%
  • C++ 2.6%
  • Shell 0.5%
  • Makefile 0.4%
  • Other 0.2%