-
Notifications
You must be signed in to change notification settings - Fork 6
/
StarIOAdapter.js
30 lines (24 loc) · 1.03 KB
/
StarIOAdapter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
document.addEventListener("deviceready", function() {
window.StarIOAdapter = {};
var handle_error_callback = function(error_message) {
alert(error_message);
};
/**
* Checks the status of the bluetooth printer and returns the string "OK" if the printer is online
*/
window.StarIOAdapter.check = function(port_search, success_callback, error_callback) {
if(error_callback == null) {
error_callback = handle_error_callback;
}
return cordova.exec(success_callback, error_callback, "StarIOAdapter", "check", [port_search]);
};
/**
* Launches a raw print on the printer, it returns a string with "OK" if the sending was fine
*/
window.StarIOAdapter.rawprint = function(message, port_search, success_callback, error_callback) {
if(error_callback == null) {
error_callback = handle_error_callback;
}
return cordova.exec(success_callback, error_callback, "StarIOAdapter", "rawprint", [message, port_search]);
};
}, false);