Skip to content

Implement basic features of the Pebble iOS SDK.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

brianrowe/TiPebble

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TiPebble

Build Status

Implements basic features of the Pebble iOS SDK.

Pebble Screenshot

Quick Start

Get it gitTio

Download the latest distribution ZIP-file and consult the Titanium Documentation on how install it, or simply use the gitTio CLI:

$ gittio install org.beuckman.tipebble

Usage

Add this to your <ios><plist><dict> section in tiapp.xml:

	<key>UISupportedExternalAccessoryProtocols</key>
	<array>
		<string>com.getpebble.public</string>
	</array>

You'll need your Pebble app's UUID here:

var pebble = require('org.beuckman.tipebble');

// this demo uuid is from the pebble documentation
pebble.setAppUUID("226834ae-786e-4302-a52f-6e7efc9f990b");

Respond when the Pebble app connects/disconnects:

function watchConnected(e) {
    pebble.getVersionInfo({
        success: function(e) {
            alert(e);
        },
        error: function(e) {
            alert(e);
        }
    });
}
function watchDisonnected(e) {
    alert("watchDisconnected");
}

pebble.addEventListener("watchConnected", watchConnected);
pebble.addEventListener("watchDisconnected", watchDisonnected);

Launch or kill your Pebble app:

function launchApp() {
  pebble.launchApp({
      success: function(e) {
          Ti.API.info(e);
      },
      error: function(e) {
          alert(e);
      }
  });
}

function killApp() {
  pebble.killApp({
      success: function(e) {
          Ti.API.info(e);
      },
      error: function(e) {
          alert(e);
      }
  });
}

Send messages to the app with integer keys and string or integer values:

function sendMessage() {
  pebble.sendMessage({
    message: {
      0: 123,
      1: 'TiPebble'
    },
    success: function(e) {
      Ti.API.info(e);
    },
    error : function(e) {
      Ti.API.error(e);
    }
  });
}

Send an image for display on the Pebble caution

This requires your Pebble app to implement image receiving code as appears in the example Pebble app. Images on the Pebble must have width a multiple of 32 pixels. If your image is not a multiple of 32 pixels wide, a black border will be added to the right, expanding to the next multiple of 32.

function sendImage() {

  var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'image.png');

  pebble.sendImage({
    image : f.read(),
    key: 2,
    success: function(e) {
      Ti.API.info(e);
    },
    error : function(e) {
      Ti.API.error(e);
    }
  });
}

About

Implement basic features of the Pebble iOS SDK.

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published