#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.
#Usage
##Getting the sources
- 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.
on the Mac there currently are two ConnectionController implementations.
-
MWBluetoothController (uses IOBluetooth)
-
MWSerialPortController (writes to a tty directly)
[MWMetaWatch sharedWatch].connectionController = [MWBluetoothController sharedController];
on iOS there is:
-
MWBTStackController which wraps arround libBTStack (jailbreak required)
-
MWCoreBluetoothController which is adds support for BLE and the new MetaWatch (no jailbreak required)
[MWMetaWatch sharedWatch].connectionController = [MWCoreBluetoothController sharedController];
[MWMetaWatch sharedWatch]startSearch];
[MWMetaWatch sharedWatch]writeText:@"yay MetaWatch"];
NSImage *template = [NSImage imageNamed:@"myTemplate.bmp"];
NSData *imgData = [MWImageTools imageDataForImage:img];
[MWMetaWatch sharedWatch]writeImage:imgData];
[MWMetaWatch sharedWatch]writeNotification:@"Test Notification"
withContent:@"Notification content"
fromSource:@"Notification source"];
[[MWMetaWatch sharedWatch]enableButton:kMODE_IDLE index:kBUTTON_A type:kBUTTON_TYPE_IMMEDIATE];
[[MWMetaWatch sharedWatch]enableButton:kMODE_IDLE index:kBUTTON_B type:kBUTTON_TYPE_IMMEDIATE];
[[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:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
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.