diff --git a/Comm Watch/.project b/Comm Watch/.project deleted file mode 100644 index cac0670..0000000 --- a/Comm Watch/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Comm - - - - - - connectiq.builder - - - - - - connectiq.projectNature - - diff --git a/Comm Watch/manifest.xml b/Comm Watch/manifest.xml deleted file mode 100644 index 51e35d9..0000000 --- a/Comm Watch/manifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eng - - - diff --git a/Comm Watch/monkey.jungle b/Comm Watch/monkey.jungle deleted file mode 100644 index 87796c7..0000000 --- a/Comm Watch/monkey.jungle +++ /dev/null @@ -1 +0,0 @@ -project.manifest = manifest.xml diff --git a/Comm Watch/resources/bitmaps.xml b/Comm Watch/resources/bitmaps.xml deleted file mode 100644 index f3b412f..0000000 --- a/Comm Watch/resources/bitmaps.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/Comm Watch/resources/images/icon.png b/Comm Watch/resources/images/icon.png deleted file mode 100644 index bdc7144..0000000 Binary files a/Comm Watch/resources/images/icon.png and /dev/null differ diff --git a/Comm Watch/resources/images/monkey.png b/Comm Watch/resources/images/monkey.png deleted file mode 100644 index 2f172d7..0000000 Binary files a/Comm Watch/resources/images/monkey.png and /dev/null differ diff --git a/Comm Watch/resources/resources.xml b/Comm Watch/resources/resources.xml deleted file mode 100644 index ec1ade4..0000000 --- a/Comm Watch/resources/resources.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Comm Watch/resources/strings.xml b/Comm Watch/resources/strings.xml deleted file mode 100644 index 2c6552a..0000000 --- a/Comm Watch/resources/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Comm - \ No newline at end of file diff --git a/Comm Watch/source/CommApp.mc b/Comm Watch/source/CommApp.mc deleted file mode 100644 index 2e40c73..0000000 --- a/Comm Watch/source/CommApp.mc +++ /dev/null @@ -1,84 +0,0 @@ -// -// Copyright 2015-2016 by Garmin Ltd. or its subsidiaries. -// Subject to Garmin SDK License Agreement and Wearables -// Application Developer Agreement. -// - -using Toybox.Application; -using Toybox.Communications; -using Toybox.WatchUi; -using Toybox.System; - -var page = 0; -var strings = ["","","","",""]; -var stringsSize = 5; -var mailMethod; -var phoneMethod; -var crashOnMessage = false; -var hasDirectMessagingSupport = true; - -class CommExample extends Application.AppBase { - - function initialize() { - Application.AppBase.initialize(); - - mailMethod = method(:onMail); - phoneMethod = method(:onPhone); - if(Communications has :registerForPhoneAppMessages) { - Communications.registerForPhoneAppMessages(phoneMethod); - } else if(Communications has :setMailboxListener) { - Communications.setMailboxListener(mailMethod); - } else { - hasDirectMessagingSupport = false; - } - } - - // onStart() is called on application start up - function onStart(state) { - } - - // onStop() is called when your application is exiting - function onStop(state) { - } - - // Return the initial view of your application here - function getInitialView() { - return [new CommView(), new CommInputDelegate()]; - } - - function onMail(mailIter) { - var mail; - - mail = mailIter.next(); - - while(mail != null) { - var i; - for(i = (stringsSize - 1); i > 0; i -= 1) { - strings[i] = strings[i-1]; - } - strings[0] = mail.toString(); - page = 1; - mail = mailIter.next(); - } - - Communications.emptyMailbox(); - WatchUi.requestUpdate(); - } - - function onPhone(msg) { - var i; - - if((crashOnMessage == true) && msg.data.equals("Hi")) { - msg.length(); // Generates a symbol not found error in the VM - } - - for(i = (stringsSize - 1); i > 0; i -= 1) { - strings[i] = strings[i-1]; - } - strings[0] = msg.data.toString(); - page = 1; - - WatchUi.requestUpdate(); - } - -} \ No newline at end of file diff --git a/Comm Watch/source/CommDelegate.mc b/Comm Watch/source/CommDelegate.mc deleted file mode 100644 index e27e362..0000000 --- a/Comm Watch/source/CommDelegate.mc +++ /dev/null @@ -1,124 +0,0 @@ -// -// Copyright 2016 by Garmin Ltd. or its subsidiaries. -// Subject to Garmin SDK License Agreement and Wearables -// Application Developer Agreement. -// - -using Toybox.WatchUi; -using Toybox.System; -using Toybox.Communications; - -class CommListener extends Communications.ConnectionListener { - function initialize() { - Communications.ConnectionListener.initialize(); - } - - function onComplete() { - System.println("Transmit Complete"); - } - - function onError() { - System.println("Transmit Failed"); - } -} - -class CommInputDelegate extends WatchUi.BehaviorDelegate { - function initialize() { - WatchUi.BehaviorDelegate.initialize(); - } - - function onMenu() { - var menu = new WatchUi.Menu(); - var delegate; - - menu.addItem("Send Data", :sendData); - menu.addItem("Set Listener", :setListener); - delegate = new BaseMenuDelegate(); - WatchUi.pushView(menu, delegate, SLIDE_IMMEDIATE); - - return true; - } - - function onTap(event) { - if(page == 0) { - page = 1; - } else { - page = 0; - } - WatchUi.requestUpdate(); - } -} - -class BaseMenuDelegate extends WatchUi.MenuInputDelegate { - function initialize() { - WatchUi.MenuInputDelegate.initialize(); - } - - function onMenuItem(item) { - var menu = new WatchUi.Menu(); - var delegate = null; - - if(item == :sendData) { - menu.addItem("Hello World.", :hello); - menu.addItem("Ackbar", :trap); - menu.addItem("Garmin", :garmin); - delegate = new SendMenuDelegate(); - } else if(item == :setListener) { - menu.setTitle("Listner Type"); - menu.addItem("Mailbox", :mailbox); - if(Communications has :registerForPhoneAppMessages) { - menu.addItem("Phone Application", :phone); - } - menu.addItem("None", :none); - menu.addItem("Crash if 'Hi'", :phoneFail); - delegate = new ListnerMenuDelegate(); - } - - WatchUi.pushView(menu, delegate, SLIDE_IMMEDIATE); - } -} - -class SendMenuDelegate extends WatchUi.MenuInputDelegate { - function initialize() { - WatchUi.MenuInputDelegate.initialize(); - } - - function onMenuItem(item) { - var listener = new CommListener(); - - if(item == :hello) { - Communications.transmit("Hello World.", null, listener); - } else if(item == :trap) { - Communications.transmit("IT'S A TRAP!", null, listener); - } else if(item == :garmin) { - Communications.transmit("ConnectIQ", null, listener); - } - - WatchUi.popView(SLIDE_IMMEDIATE); - } -} - -class ListnerMenuDelegate extends WatchUi.MenuInputDelegate { - function initialize() { - WatchUi.MenuInputDelegate.initialize(); - } - - function onMenuItem(item) { - if(item == :mailbox) { - Communications.setMailboxListener(mailMethod); - } else if(item == :phone) { - if(Communications has :registerForPhoneAppMessages) { - Communications.registerForPhoneAppMessages(phoneMethod); - } - } else if(item == :none) { - Communications.registerForPhoneAppMessages(null); - Communications.setMailboxListener(null); - } else if(item == :phoneFail) { - crashOnMessage = true; - Communications.registerForPhoneAppMessages(phoneMethod); - } - - WatchUi.popView(SLIDE_IMMEDIATE); - } -} - diff --git a/Comm Watch/source/CommView.mc b/Comm Watch/source/CommView.mc deleted file mode 100644 index ca39067..0000000 --- a/Comm Watch/source/CommView.mc +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright 2016 by Garmin Ltd. or its subsidiaries. -// Subject to Garmin SDK License Agreement and Wearables -// Application Developer Agreement. -// - -using Toybox.WatchUi; -using Toybox.Graphics; -using Toybox.Communications; -using Toybox.System; - -class CommView extends WatchUi.View { - var screenShape; - - function initialize() { - View.initialize(); - } - - function onLayout(dc) { - screenShape = System.getDeviceSettings().screenShape; - } - - function drawIntroPage(dc) { - if(System.SCREEN_SHAPE_ROUND == screenShape) { - dc.drawText(dc.getWidth() / 2, 25, Graphics.FONT_SMALL, "Communications", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 55, Graphics.FONT_SMALL, "Test", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 80, Graphics.FONT_TINY, "Connect a phone then", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 100, Graphics.FONT_TINY, "use the menu to send", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 120, Graphics.FONT_TINY, "strings to your phone", Graphics.TEXT_JUSTIFY_CENTER); - } else if(System.SCREEN_SHAPE_SEMI_ROUND == screenShape) { - dc.drawText(dc.getWidth() / 2, 20, Graphics.FONT_MEDIUM, "Communications test", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 50, Graphics.FONT_SMALL, "Connect a phone", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 70, Graphics.FONT_SMALL, "Then use the menu to send", Graphics.TEXT_JUSTIFY_CENTER); - dc.drawText(dc.getWidth() / 2, 90, Graphics.FONT_SMALL, "strings to your phone", Graphics.TEXT_JUSTIFY_CENTER); - } else if(dc.getWidth() > dc.getHeight()) { - dc.drawText(10, 20, Graphics.FONT_MEDIUM, "Communications test", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 50, Graphics.FONT_SMALL, "Connect a phone", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 70, Graphics.FONT_SMALL, "Then use the menu to send", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 90, Graphics.FONT_SMALL, "strings to your phone", Graphics.TEXT_JUSTIFY_LEFT); - } else { - dc.drawText(10, 20, Graphics.FONT_MEDIUM, "Communications test", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 40, Graphics.FONT_MEDIUM, "Test", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 70, Graphics.FONT_SMALL, "Connect a phone", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 90, Graphics.FONT_SMALL, "Then use the menu", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 110, Graphics.FONT_SMALL, "to send strings", Graphics.TEXT_JUSTIFY_LEFT); - dc.drawText(10, 130, Graphics.FONT_SMALL, "to your phone", Graphics.TEXT_JUSTIFY_LEFT); - } - } - - function onUpdate(dc) { - dc.setColor(Graphics.COLOR_TRANSPARENT, Graphics.COLOR_BLACK); - dc.clear(); - dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); - - if(hasDirectMessagingSupport) { - if(page == 0) { - drawIntroPage(dc); - } else { - var i; - var y = 50; - - dc.drawText(dc.getWidth() / 2, 20, Graphics.FONT_MEDIUM, "Strings Received:", Graphics.TEXT_JUSTIFY_CENTER); - for(i = 0; i < stringsSize; i += 1) { - dc.drawText(dc.getWidth() / 2, y, Graphics.FONT_SMALL, strings[i], Graphics.TEXT_JUSTIFY_CENTER); - y += 20; - } - } - } else { - dc.drawText(dc.getWidth() / 2, dc.getHeight() / 3, Graphics.FONT_MEDIUM, "Direct Messaging API\nNot Supported", Graphics.TEXT_JUSTIFY_CENTER); - } - } - - -} \ No newline at end of file diff --git a/CommWatch.prg b/CommWatch.prg deleted file mode 100644 index f304194..0000000 Binary files a/CommWatch.prg and /dev/null differ diff --git a/README.md b/README.md index 4c5d3d1..a357044 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,9 @@ Example [License]. - Run on phone. #### Comm Watch Sample -- The Comm Watch application is a sample application for ConnectIQ -- Compile using Visual Studio Code https://developer.garmin.com/connect-iq/reference-guides/visual-studio-code-extension/ -- Generate PRG file or use [CommWatch.prg] (the already compiled app) -- Copy PRG file to the watch +- The Comm Watch application is a sample application for ConnectIQ to be used with above mentioned Example App +- Get the app and the code for it by downloading the [ConnecIQ SDK for devices]. +- The Comm Watch application is available in the "samples" folder of the [ConnecIQ SDK for devices] and the instructions for installing the app are available at [Your first app]'s "Importing an Example" section ## Other Useful Info @@ -63,6 +62,7 @@ Please be sure to refer to the