Initial commit: Android & Garmin Remote Camera App with Live Preview
This commit is contained in:
39
garmin-app/source/FotoCompanionDelegate.mc
Normal file
39
garmin-app/source/FotoCompanionDelegate.mc
Normal file
@@ -0,0 +1,39 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user