40 lines
948 B
MonkeyC
40 lines
948 B
MonkeyC
import Toybox.Lang;
|
|
import Toybox.WatchUi;
|
|
import Toybox.Communications;
|
|
import Toybox.System;
|
|
|
|
class FotoCompanionDelegate extends WatchUi.BehaviorDelegate {
|
|
var view;
|
|
|
|
function initialize(v) {
|
|
BehaviorDelegate.initialize();
|
|
view = v;
|
|
}
|
|
|
|
function onSelect() as Boolean {
|
|
// Send Trigger command to Android
|
|
// We use a simple string "TRIGGER"
|
|
try {
|
|
Communications.transmit("TRIGGER", null, new CommsListener());
|
|
System.println("Trigger sent");
|
|
} catch (ex) {
|
|
System.println("Error sending: " + ex.getErrorMessage());
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
class CommsListener extends Communications.ConnectionListener {
|
|
function initialize() {
|
|
ConnectionListener.initialize();
|
|
}
|
|
|
|
function onComplete() {
|
|
System.println("Tx Complete");
|
|
}
|
|
|
|
function onError() {
|
|
System.println("Tx Error");
|
|
}
|
|
}
|