diff options
Diffstat (limited to 'Waydio.h')
| -rw-r--r-- | Waydio.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/Waydio.h b/Waydio.h new file mode 100644 index 0000000..33dbecc --- /dev/null +++ b/Waydio.h @@ -0,0 +1,136 @@ +// +// Waydio.h +// waydio_comms_demo +// +// Created by Tim Redfern on 01/09/2013. +// +// + +// +// ios_brsp_lib +// Created by Michael Testa on 11/1/12. +// Copyright (c) 2012 BlueRadios, Inc. All rights reserved. +// + +//The BRSP service UUID. Use this in a CBCentralManager scan to filter +#define BRSP_SERVICE_UUID @"DA2B84F1-6279-48DE-BDC0-AFBEA0226079" + +#import <Foundation/Foundation.h> +#import <CoreBluetooth/CoreBluetooth.h> +#import "Brsp.h" + +@class Waydio; + +@protocol WaydioDelegate <NSObject> + +@required +/** + Called when the open status has changed after a call to either open or close. + @param waydio The Waydio object generating this event + @param isOpen YES == Open + */ +- (void)waydio:(Waydio*)waydio OpenStatusChanged:(BOOL)isOpen; +/** + Called when the measured weight changes + @param waydio The Waydio object generating this event + @param weight + */ +- (void)waydio:(Waydio*)waydio WeightChanged:(Float32)weight; +/** + Called when the battery level changes + @param waydio The Waydio object generating this event + @param batteryPercent + */ +- (void)waydio:(Waydio*)waydio BatteryChanged:(Float32)batteryPercent; +/** + Called when the isSending changes + @param waydio The Waydio object generating this event + @param isOpen YES == Pressed + */ +- (void)waydio:(Waydio*)waydio ButtonChanged:(BOOL)isPressed; + +@optional + +/** + Used to pass on CBPeripheral errors that may occur + @param brsp The Brsp object generating this event + @param error NSError object containing the error + */ +- (void)waydio:(Waydio*)waydio ErrorReceived:(NSError*)error; + +@end + +/** + Class used to interact with the Waydio peripheral + */ +@interface Waydio : NSObject <CBPeripheralDelegate> { + + id <WaydioDelegate> delegate; +} + +/** + The delegate used for WaydioDelegate events. + */ +@property (retain) id <WaydioDelegate> delegate; +/** + A pointer to the CBPeripheral object that is associated with this device. + */ +@property (nonatomic, readonly) CBPeripheral *peripheral; +/** + An integer indicating the level of security enforced by the Waydio service on the opened port + 0 == None, 1 == Unauthenticated Pairing With Encryption, 2 == Authenticated Pairing With Encryption, 99 = Unknown + */ +@property (nonatomic, readonly) NSUInteger securityLevel; +/** + Waydio open/closed status + YES = Open + */ +@property (nonatomic, readonly) BOOL isOpen; + +/** + The BRSP object used to communicate with waydio + */ +@property (strong, nonatomic) Brsp *brspObject; + +/** + A Convenience function that returns a CBUUID for the brsp Service + @return CBUUID object for service "DA2B84F1-6279-48DE-BDC0-AFBEA0226079" + */ ++ (CBUUID *) brspServiceUUID; + +/** + Initializer for this class + @param peripheral The CBPeripheral object to be used + @return self + @note Changes peripheral.delegate to self. If peripheral.delegate is set another object, initWithPeripheral and open will have to be called again + to reinitialize. + @note The default input and output buffer sizes are 1024 bytes + */ +- (id)initWithPeripheral:(CBPeripheral*)peripheral; + +/** + An alternate initializer for this class which sets the input and output buffer sizes. + Use this if the default buffer sizes are not adequate + @param peripheral The CBPeripheral object to be used + @param in_size The fixed input buffer size to use + @param out_size The fixed output buffer size to use + @return self + @note Changes peripheral.delegate to self. If peripheral.delegate is set another object, initWithPeripheral and open will have to be called again + to reinitialize. + @note The default input and output buffer sizes are 1024 bytes + */ +- (id)initWithPeripheral:(CBPeripheral*)peripheral InputBufferSize:(NSUInteger)in_size OutputBufferSize:(NSUInteger)out_size; + +/** + Opens a Waydio connection. (Prepares peipheral for using the Waydio service, characteristics, and notifications) + */ +- (void)open; + +/** + Closes a Waydio connection. (Turns off notifications, etc) + */ +- (void)close; + + + +@end |
