Skip to content
/ MWKit Public

A Cocoa/CocoaTouch Framework for communicating with the Fossil MetaWatch

Notifications You must be signed in to change notification settings

ka010/MWKit

Repository files navigation

#About

MWKit is a Cocoa/CocoaTouch framework for communicating with the MetaWatch

#Features

  • NEW: support for iOS BLE and the new MetaWatch (AU2001 and AU2004)
  • Implements the MetaWatch Message Protocol
  • Modular Architecture
    • Mac OSX support via IOBluetooth or IOCTL
    • iOS support via btstack and CoreBluetooth
  • Device Inquiry or direct connections
  • Image rendering
  • Text rendering
  • Button configuration and events

#Demo There's a neat little demo project that shows how to use MWKit on both, iOS and OSX.

Available right here

#Usage

##Getting the sources

  1. MWKit Sources
git clone [email protected]:ka010/MWKit.git

##Using MWKit

In general all interaction with the watch happens through the MWMetaWatch class, while the actual connection is handled by a subclass of MWConnectionController.

Before the MetaWatch object can be used, it needs to be initialized with a ConnectionController.

Initializing MWKit

Mac OSX

on the Mac there currently are two ConnectionController implementations.

  1. MWBluetoothController (uses IOBluetooth)

  2. MWSerialPortController (writes to a tty directly)

[MWMetaWatch sharedWatch].connectionController = [MWBluetoothController sharedController];

iOS

on iOS there is:

  1. MWBTStackController which wraps arround libBTStack (jailbreak required)

  2. MWCoreBluetoothController which is adds support for BLE and the new MetaWatch (no jailbreak required)

[MWMetaWatch sharedWatch].connectionController = [MWCoreBluetoothController sharedController];

Device Inquiry

[MWMetaWatch sharedWatch]startSearch];

Writing to the watch-display

Text

[MWMetaWatch sharedWatch]writeText:@"yay MetaWatch"];

Images

NSImage *template = [NSImage imageNamed:@"myTemplate.bmp"];

NSData *imgData = [MWImageTools imageDataForImage:img];

[MWMetaWatch sharedWatch]writeImage:imgData];

Notifications

[MWMetaWatch sharedWatch]writeNotification:@"Test Notification"
   								withContent:@"Notification content"
								fromSource:@"Notification source"];

Configuring the watch-buttons

Enable Button

[[MWMetaWatch sharedWatch]enableButton:kMODE_IDLE index:kBUTTON_A type:kBUTTON_TYPE_IMMEDIATE];

Disable Button

[[MWMetaWatch sharedWatch]enableButton:kMODE_IDLE index:kBUTTON_B type:kBUTTON_TYPE_IMMEDIATE];

Revieving Button events

[[NSNotificationCenter defaultCenter]addObserver:self 
                                            selector:@selector(mwDidReceiveButtonPress:) 
                                                name:MWKitDidReceivePuttonPress object:nil];
-(void)mwDidReceiveButtonPress:(NSNotification*)aNotification {

    NSLog(@"Button %@ pressed",[aNotification object]);

}

#FreeBSD License

Copyright 2011 Kai Aras. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY Kai Aras "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Kai Aras OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Kai Aras.

About

A Cocoa/CocoaTouch Framework for communicating with the Fossil MetaWatch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published