├── BLEduino
├── en.lproj
│ └── InfoPlist.strings
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ ├── app-icon.png
│ │ └── Contents.json
│ ├── JoystickHold.imageset
│ │ ├── joystick-hold.png
│ │ ├── joystick-hold-1.png
│ │ └── Contents.json
│ ├── JoystickBackground.imageset
│ │ ├── joystick-bg.png
│ │ └── Contents.json
│ ├── JoystickNeutral.imageset
│ │ ├── joystick-neutral.png
│ │ └── Contents.json
│ └── MenuBackground.imageset
│ │ ├── MenuBackground@2x.png
│ │ └── Contents.json
├── BleduinoRootController.h
├── OrientationNavigationController.h
├── ConsoleCell.h
├── AppDelegate.h
├── ConsoleNavigationViewController.h
├── ConsoleEntries.h
├── SettingsNumberCell.h
├── SettingsSwitchCell.h
├── ProximityAlert.m
├── ModuleCollectionViewCell.h
├── main.m
├── FirmataAnalogCell.h
├── FirmataDigitalCell.h
├── SettingsTableViewController.h
├── PowerNextStateView.h
├── ProximityAlert.h
├── VerticalJoystickControlView.h
├── HorizontalJoystickControlView.h
├── ProximityRSSISettingsController.h
├── SideMenuTableViewController.h
├── FirmataPWMCell.h
├── TimeDelayTableViewCell.h
├── LEDModuleTableViewController.h
├── ModuleCollectionViewCell.m
├── BleduinoRootController.m
├── PowerSwitchButtonView.h
├── SettingsNumberCell.m
├── SettingsSwitchCell.m
├── ConsoleCell.m
├── GameControllerViewController.h
├── LCDTableViewController.h
├── KeyboardModuleTableViewController.h
├── PowerNextStateView.m
├── PowerRelayViewController.h
├── RadioControlledViewController.h
├── ConsoleEntries.m
├── FirmataTableViewController.h
├── RSSIAlertController.h
├── OrientationNavigationController.m
├── ConsoleTableViewController.h
├── DistanceAlertController.h
├── FirmataAnalogCell.m
├── FirmataPWMCell.m
├── FirmataDigitalCell.m
├── TimeDelayTableViewCell.m
├── ProximityViewController.h
├── SequencerTableViewController.h
├── ModulesCollectionViewController.h
├── ConsoleNavigationViewController.m
├── BLEduino-Info.plist
├── VerticalJoystickControlView.m
├── HorizontalJoystickControlView.m
├── PowerRelayViewController.m
├── RSSIAlertController.m
├── KeyboardModuleTableViewController.m
├── PowerSwitchButtonView.m
├── ProximityRSSISettingsController.m
└── DistanceAlertController.m
├── Images
├── add.png
├── car.png
├── lcd.png
├── led.png
├── menu.png
├── add@2x.png
├── blue-x.png
├── bridge.png
├── button.png
├── console.png
├── contact.png
├── delay.png
├── firmata.png
├── green-y.png
├── manager.png
├── menu@2x.png
├── modules.png
├── power.png
├── red-a.png
├── appicon58.png
├── appicon80.png
├── arrow-up.png
├── bridge-s.png
├── delay@2x.png
├── hardware.png
├── keyboard.png
├── launch960.png
├── led-small.png
├── proximity.png
├── sequencer.png
├── settings.png
├── tutorials.png
├── yellow-b.png
├── appicon120.png
├── arrow-down.png
├── arrow-left.png
├── arrow-right.png
├── arrow-up@2x.png
├── contact@2x.png
├── controller.png
├── hardware@2x.png
├── joystick-bg.png
├── launch1136.png
├── led-small@2x.png
├── manager@2x.png
├── midnight-bg.jpg
├── modules@2x.png
├── rotate-left.png
├── settings@2x.png
├── strength-0.png
├── strength-1.png
├── strength-2.png
├── strength-3.png
├── strength-4.png
├── strength-5.png
├── tutorials@2x.png
├── arrow-down@2x.png
├── arrow-left@2x.png
├── arrow-right@2x.png
├── joystick-hold.png
├── notifications.png
├── joystick-neutral.png
└── notifications-s.png
├── BLEduinoTests
├── en.lproj
│ └── InfoPlist.strings
├── BLEduinoTests-Info.plist
└── BLEduinoTests.m
├── Default-568h@2x.png
├── README.md
├── BLEduino.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── ramongonzalez.xcuserdatad
│ │ └── WorkspaceSettings.xcsettings
│ │ └── valerieann.xcuserdatad
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ ├── valerieann.xcuserdatad
│ ├── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── BLEduino.xcscheme
│ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ └── ramongonzalez.xcuserdatad
│ ├── xcschemes
│ ├── xcschememanagement.plist
│ └── BLEduino.xcscheme
│ └── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
├── BLEduino-Libray
├── BDQueue.h
├── BDQueue.m
├── BleduinoController.h
├── BDNotificationAttributes.m
├── BDNotificationAttributes.h
├── LeDiscoveryTableViewController.h
├── BDThrottleYawRollPitch.h
├── BDProximity.h
├── BDButtonAction.h
├── BDNotifications.h
├── BDBridge.h
├── BDFirmataCommand.h
├── BDController.h
├── BDFirmata.h
├── BDButtonAction.m
├── BDVehicleMotion.h
├── BDBleBridge.h
├── BDNotification.h
├── BDThrottleYawRollPitch.m
├── BleduinoController.m
├── BDUart.h
├── BDObject.h
└── BDFirmataCommand.m
└── Libraries
├── PSPDFTextView
└── PSPDFTextView.h
├── MFLJoystick
└── MFLJoystick.h
├── UIImage+ColorAtPixel
├── UIImage+ColorAtPixel.h
└── UIImage+ColorAtPixel.m
├── RESideMenu
├── UIViewController+RESideMenu.h
├── RECommonFunctions.h
├── RECommonFunctions.m
├── UIViewController+RESideMenu.m
└── RESideMenu.h
└── OBShapedButton
├── OBShapedButton.h
└── OBShapedButton.m
/BLEduino/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/add.png
--------------------------------------------------------------------------------
/Images/car.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/car.png
--------------------------------------------------------------------------------
/Images/lcd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/lcd.png
--------------------------------------------------------------------------------
/Images/led.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/led.png
--------------------------------------------------------------------------------
/Images/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/menu.png
--------------------------------------------------------------------------------
/BLEduinoTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Images/add@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/add@2x.png
--------------------------------------------------------------------------------
/Images/blue-x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/blue-x.png
--------------------------------------------------------------------------------
/Images/bridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/bridge.png
--------------------------------------------------------------------------------
/Images/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/button.png
--------------------------------------------------------------------------------
/Images/console.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/console.png
--------------------------------------------------------------------------------
/Images/contact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/contact.png
--------------------------------------------------------------------------------
/Images/delay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/delay.png
--------------------------------------------------------------------------------
/Images/firmata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/firmata.png
--------------------------------------------------------------------------------
/Images/green-y.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/green-y.png
--------------------------------------------------------------------------------
/Images/manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/manager.png
--------------------------------------------------------------------------------
/Images/menu@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/menu@2x.png
--------------------------------------------------------------------------------
/Images/modules.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/modules.png
--------------------------------------------------------------------------------
/Images/power.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/power.png
--------------------------------------------------------------------------------
/Images/red-a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/red-a.png
--------------------------------------------------------------------------------
/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Default-568h@2x.png
--------------------------------------------------------------------------------
/Images/appicon58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/appicon58.png
--------------------------------------------------------------------------------
/Images/appicon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/appicon80.png
--------------------------------------------------------------------------------
/Images/arrow-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-up.png
--------------------------------------------------------------------------------
/Images/bridge-s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/bridge-s.png
--------------------------------------------------------------------------------
/Images/delay@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/delay@2x.png
--------------------------------------------------------------------------------
/Images/hardware.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/hardware.png
--------------------------------------------------------------------------------
/Images/keyboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/keyboard.png
--------------------------------------------------------------------------------
/Images/launch960.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/launch960.png
--------------------------------------------------------------------------------
/Images/led-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/led-small.png
--------------------------------------------------------------------------------
/Images/proximity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/proximity.png
--------------------------------------------------------------------------------
/Images/sequencer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/sequencer.png
--------------------------------------------------------------------------------
/Images/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/settings.png
--------------------------------------------------------------------------------
/Images/tutorials.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/tutorials.png
--------------------------------------------------------------------------------
/Images/yellow-b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/yellow-b.png
--------------------------------------------------------------------------------
/Images/appicon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/appicon120.png
--------------------------------------------------------------------------------
/Images/arrow-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-down.png
--------------------------------------------------------------------------------
/Images/arrow-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-left.png
--------------------------------------------------------------------------------
/Images/arrow-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-right.png
--------------------------------------------------------------------------------
/Images/arrow-up@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-up@2x.png
--------------------------------------------------------------------------------
/Images/contact@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/contact@2x.png
--------------------------------------------------------------------------------
/Images/controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/controller.png
--------------------------------------------------------------------------------
/Images/hardware@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/hardware@2x.png
--------------------------------------------------------------------------------
/Images/joystick-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/joystick-bg.png
--------------------------------------------------------------------------------
/Images/launch1136.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/launch1136.png
--------------------------------------------------------------------------------
/Images/led-small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/led-small@2x.png
--------------------------------------------------------------------------------
/Images/manager@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/manager@2x.png
--------------------------------------------------------------------------------
/Images/midnight-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/midnight-bg.jpg
--------------------------------------------------------------------------------
/Images/modules@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/modules@2x.png
--------------------------------------------------------------------------------
/Images/rotate-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/rotate-left.png
--------------------------------------------------------------------------------
/Images/settings@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/settings@2x.png
--------------------------------------------------------------------------------
/Images/strength-0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-0.png
--------------------------------------------------------------------------------
/Images/strength-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-1.png
--------------------------------------------------------------------------------
/Images/strength-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-2.png
--------------------------------------------------------------------------------
/Images/strength-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-3.png
--------------------------------------------------------------------------------
/Images/strength-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-4.png
--------------------------------------------------------------------------------
/Images/strength-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/strength-5.png
--------------------------------------------------------------------------------
/Images/tutorials@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/tutorials@2x.png
--------------------------------------------------------------------------------
/Images/arrow-down@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-down@2x.png
--------------------------------------------------------------------------------
/Images/arrow-left@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-left@2x.png
--------------------------------------------------------------------------------
/Images/arrow-right@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/arrow-right@2x.png
--------------------------------------------------------------------------------
/Images/joystick-hold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/joystick-hold.png
--------------------------------------------------------------------------------
/Images/notifications.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/notifications.png
--------------------------------------------------------------------------------
/Images/joystick-neutral.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/joystick-neutral.png
--------------------------------------------------------------------------------
/Images/notifications-s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/Images/notifications-s.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | bleduino-ios
2 | ============
3 |
4 | All the software for the BLEduino iOS library, and application.
5 |
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/AppIcon.appiconset/app-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/AppIcon.appiconset/app-icon.png
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickHold.imageset/joystick-hold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/JoystickHold.imageset/joystick-hold.png
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickBackground.imageset/joystick-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/JoystickBackground.imageset/joystick-bg.png
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickHold.imageset/joystick-hold-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/JoystickHold.imageset/joystick-hold-1.png
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickNeutral.imageset/joystick-neutral.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/JoystickNeutral.imageset/joystick-neutral.png
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/MenuBackground.imageset/MenuBackground@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BLEduino/bleduino-ios/HEAD/BLEduino/Images.xcassets/MenuBackground.imageset/MenuBackground@2x.png
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/BLEduino/BleduinoRootController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BleduinoRoot.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/12/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "RESideMenu.h"
11 |
12 | @interface BleduinoRootController : RESideMenu
13 | @end
14 |
--------------------------------------------------------------------------------
/BLEduino/OrientationNavigationController.h:
--------------------------------------------------------------------------------
1 | //
2 | // OrientationNavigationController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/22/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface OrientationNavigationController : UINavigationController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/23/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ConsoleCell : UITableViewCell
12 | @property IBOutlet UILabel *entry;
13 | @property IBOutlet UILabel *time;
14 | @end
15 |
--------------------------------------------------------------------------------
/BLEduino/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 9/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleNavigationViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleNavigationViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/4/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "OrientationNavigationController.h"
10 |
11 | @interface ConsoleNavigationViewController : OrientationNavigationController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "joystick-bg.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickNeutral.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "joystick-neutral.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/MenuBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "MenuBackground@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/BLEduino/ConsoleEntries.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleEntries.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/22/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ConsoleEntries : NSObject
12 | @property NSString *text;
13 | @property NSDate *time;
14 | @property BOOL isBLEduino;
15 | - (NSString *)timeString;
16 | @end
17 |
--------------------------------------------------------------------------------
/BLEduino/SettingsNumberCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SettingsNumberCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SettingsNumberCell : UITableViewCell
12 | @property (weak) IBOutlet UILabel *settingDescription;
13 | @property (weak) IBOutlet UILabel *settingsNumber;
14 | @end
15 |
--------------------------------------------------------------------------------
/BLEduino/SettingsSwitchCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SettingsSwitchCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SettingsSwitchCell : UITableViewCell
12 | @property (weak) IBOutlet UILabel *settingDescription;
13 | @property (weak) IBOutlet UISwitch *settingsStatus;
14 | @end
15 |
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/JoystickHold.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "joystick-hold-1.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x",
11 | "filename" : "joystick-hold.png"
12 | }
13 | ],
14 | "info" : {
15 | "version" : 1,
16 | "author" : "xcode"
17 | }
18 | }
--------------------------------------------------------------------------------
/BLEduino/ProximityAlert.m:
--------------------------------------------------------------------------------
1 | //
2 | // DistanceAlert.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/18/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ProximityAlert.h"
10 |
11 | @implementation ProximityAlert
12 |
13 | - (BOOL)isProximityAlertReady
14 | {
15 | double now = CACurrentMediaTime();
16 | return ((now - self.lastShow) >= 5.0);
17 | }
18 | @end
19 |
--------------------------------------------------------------------------------
/BLEduino/ModuleCollectionViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ModuleCollectionViewCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/1/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ModuleCollectionViewCell : UICollectionViewCell
12 | @property (weak) IBOutlet UIButton *moduleIcon;
13 | @property (weak) IBOutlet UILabel *moduleName;
14 | @end
15 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDQueue.h:
--------------------------------------------------------------------------------
1 | //
2 | // BDQueue.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/6/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BDQueue : NSObject
12 | - (void)enqueue:(id)object;
13 | - (id)dequeue;
14 | + (instancetype)queue;
15 | - (id)initWithCapacity:(NSUInteger)capacity;
16 | - (NSArray *)array;
17 | @end
18 |
--------------------------------------------------------------------------------
/BLEduino/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 9/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/project.xcworkspace/xcuserdata/ramongonzalez.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/project.xcworkspace/xcuserdata/valerieann.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BLEduino/FirmataAnalogCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataAnalogCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FirmataAnalogCell : UITableViewCell
12 | @property IBOutlet UILabel *pinNumber;
13 | @property IBOutlet UILabel *pinState;
14 | @property IBOutlet UILabel *pinValue;
15 | @property UITableViewCellStateMask state;
16 | @end
17 |
--------------------------------------------------------------------------------
/BLEduino/FirmataDigitalCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataDigitalCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FirmataDigitalCell : UITableViewCell
12 | @property IBOutlet UILabel *pinNumber;
13 | @property IBOutlet UILabel *pinState;
14 | @property IBOutlet UISwitch *pinValue;
15 | @property UITableViewCellStateMask state;
16 | @end
17 |
--------------------------------------------------------------------------------
/BLEduino/SettingsTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SettingsTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 |
12 | @interface SettingsTableViewController : UITableViewController
13 | <
14 | UIAlertViewDelegate,
15 | UITextFieldDelegate,
16 | UIActionSheetDelegate
17 | >
18 | - (IBAction)showMenu;
19 | - (void)showStatusBar;
20 | @end
21 |
--------------------------------------------------------------------------------
/BLEduino/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "size" : "60x60",
15 | "idiom" : "iphone",
16 | "filename" : "app-icon.png",
17 | "scale" : "2x"
18 | }
19 | ],
20 | "info" : {
21 | "version" : 1,
22 | "author" : "xcode"
23 | }
24 | }
--------------------------------------------------------------------------------
/BLEduino/PowerNextStateView.h:
--------------------------------------------------------------------------------
1 | //
2 | // PowerOtherStateView.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/25/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class PowerNextStateView;
12 | @protocol PowerNextStateViewDelegate
13 | - (void)powerOtherStateDidUpdateWithStateOn:(BOOL)state;
14 | @end
15 |
16 | @interface PowerNextStateView : UILabel
17 | @property (weak) id delegate;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/BLEduino/ProximityAlert.h:
--------------------------------------------------------------------------------
1 | //
2 | // DistanceAlert.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/18/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ProximityAlert : NSObject
12 | @property NSInteger distance;
13 | @property NSString *message;
14 | @property double lastShow;
15 | @property BOOL isDistanceAlert;
16 | @property (readonly, getter = isProximityAlertReady) BOOL isReadyToShow;
17 | @property BOOL bleduinoIsCloser;
18 | @property BOOL bleduinoIsFarther;
19 | @end
20 |
--------------------------------------------------------------------------------
/BLEduino/VerticalJoystickControlView.h:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalJoystickControlView.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/19/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class VerticalJoystickControlView;
12 | @protocol VerticalJoystickControlViewDelegate
13 | - (void)verticalJoystickDidUpdate:(CGPoint)position;
14 | @end
15 |
16 | @interface VerticalJoystickControlView : UIView
17 | @property (weak) id delegate;
18 | @property CGPoint lastPosition;
19 | @end
--------------------------------------------------------------------------------
/BLEduino/HorizontalJoystickControlView.h:
--------------------------------------------------------------------------------
1 | //
2 | // HorizontalJoystickControlView.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/19/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class HorizontalJoystickControlView;
12 | @protocol HorizontalJoystickControlViewDelegate
13 | - (void)horizontalJoystickDidUpdate:(CGPoint)position;
14 | @end
15 |
16 | @interface HorizontalJoystickControlView : UIView
17 | @property (weak) id delegate;
18 | @property CGPoint lastPosition;
19 | @end
20 |
--------------------------------------------------------------------------------
/BLEduino/ProximityRSSISettingsController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ProximityRSSISettingsController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/11/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ProximityRSSISettingsController : UITableViewController
12 | @property IBOutlet UISlider *immediateSlider;
13 | @property IBOutlet UISlider *nearSlider;
14 | @property IBOutlet UISlider *farSlider;
15 | @property IBOutlet UILabel *immediateLabel;
16 | @property IBOutlet UILabel *nearLabel;
17 | @property IBOutlet UILabel *farLabel;
18 | @end
19 |
--------------------------------------------------------------------------------
/BLEduino/SideMenuTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SideMenuTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/12/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "RESideMenu.h"
11 | #import
12 |
13 | @interface SideMenuTableViewController : UIViewController
14 | <
15 | UITableViewDataSource,
16 | UITableViewDelegate,
17 | RESideMenuDelegate,
18 | MFMailComposeViewControllerDelegate,
19 | UIAlertViewDelegate
20 | >
21 |
22 | @property (strong, readwrite, nonatomic) UITableView *tableView;
23 |
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Libraries/PSPDFTextView/PSPDFTextView.h:
--------------------------------------------------------------------------------
1 | //
2 | // PSPDFTextView.h
3 | // PSPDFKit
4 | //
5 | // Copyright (c) 2013-2014 PSPDFKit GmbH. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | // Subclass of `UITextView` that fixes the most glaring bugs in iOS 7.
11 | @interface PSPDFTextView : UITextView
12 |
13 | // Scrolls to caret position, considering insets.
14 | - (void)scrollToVisibleCaretAnimated:(BOOL)animated;
15 |
16 | // Scroll to visible range, considering insets.
17 | - (void)scrollRangeToVisibleConsideringInsets:(NSRange)range animated:(BOOL)animated;
18 |
19 | - (void)scheduleScrollToVisibleCaretWithDelay:(NSTimeInterval)delay;
20 | @end
21 |
--------------------------------------------------------------------------------
/BLEduino/FirmataPWMCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataPWMCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FirmataPWMCell : UITableViewCell
12 | @property IBOutlet UILabel *pinNumber;
13 | @property IBOutlet UILabel *pinState;
14 | @property IBOutlet UIButton *pinValue;
15 | @property UITableViewCellStateMask state;
16 |
17 |
18 | //Redundant UILabel to display PWM value. iOS7 has a bug where the UIButton gets reloaded (with the content on the storyboard)
19 | //when a UIActionView is shown.
20 | @property IBOutlet UILabel *secondPinValue;
21 | @end
22 |
--------------------------------------------------------------------------------
/BLEduino/TimeDelayTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // TimeDelayTableViewCell.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/16/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TimeDelayTableViewCell : UITableViewCell
12 | @property IBOutlet UILabel *delayName;
13 | @property IBOutlet UILabel *delayFormat;
14 | @property IBOutlet UIButton *delayValue;
15 | @property UITableViewCellStateMask state;
16 |
17 |
18 | //Redundant UILabel to display PWM value. iOS7 has a bug where the UIButton gets reloaded (with the content on the storyboard)
19 | //when a UIActionView is shown.
20 | @property IBOutlet UILabel *secondDelayValue;
21 | @end
22 |
--------------------------------------------------------------------------------
/BLEduino/LEDModuleTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LEDModuleTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/12/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDFirmata.h"
12 |
13 | @class LEDModuleTableViewController;
14 | @protocol LEDModuleTableViewControllerDelegate
15 | - (void)ledModuleTableViewControllerDismissed:(LEDModuleTableViewController *)controller;
16 | @end
17 |
18 | @interface LEDModuleTableViewController : UITableViewController
19 | @property (weak) id delegate;
20 | - (IBAction)dismissModule;
21 | @end
22 |
--------------------------------------------------------------------------------
/BLEduino/ModuleCollectionViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ModuleCollectionViewCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/1/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ModuleCollectionViewCell.h"
10 |
11 | @implementation ModuleCollectionViewCell
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | /*
23 | // Only override drawRect: if you perform custom drawing.
24 | // An empty implementation adversely affects performance during animation.
25 | - (void)drawRect:(CGRect)rect
26 | {
27 | // Drawing code
28 | }
29 | */
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/BLEduino/BleduinoRootController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BleduinoRoot.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/12/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BleduinoRootController.h"
10 | #import "SideMenuTableViewController.h"
11 |
12 | @implementation BleduinoRootController
13 | - (void)awakeFromNib
14 | {
15 | self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentController"];
16 | self.menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"menuController"];
17 | self.backgroundImage = [UIImage imageNamed:@"midnight-bg.jpg"];
18 | self.delegate = (SideMenuTableViewController *)self.menuViewController;
19 | }
20 | @end
21 |
--------------------------------------------------------------------------------
/BLEduino/PowerSwitchButtonView.h:
--------------------------------------------------------------------------------
1 | //
2 | // PowerSwitchButtonView.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | enum {
12 | PowerSwitchStatusColorBlue = 1,
13 | PowerSwitchStatusColorGreenRed = 2,
14 | };
15 | typedef NSUInteger PowerSwitchStatusColor;
16 |
17 | @class PowerSwitchButtonView;
18 | @protocol PowerSwitchButtonViewDelegate
19 | - (void)powerSwitchDidUpdateWithStateOn:(BOOL)state;
20 | @end
21 |
22 | @interface PowerSwitchButtonView : UIView
23 | @property (weak) id delegate;
24 | - (void)updatePowerSwitchTextWithStateOn:(BOOL)isOn;
25 | @end
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/valerieann.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | BLEduino.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | B7B73BED17F256B3008E6769
16 |
17 | primary
18 |
19 |
20 | B7B73C0E17F256B3008E6769
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/ramongonzalez.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | BLEduino.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | B7B73BED17F256B3008E6769
16 |
17 | primary
18 |
19 |
20 | B7B73C0E17F256B3008E6769
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/BLEduino/SettingsNumberCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SettingsNumberCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "SettingsNumberCell.h"
10 |
11 | @implementation SettingsNumberCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/BLEduino/SettingsSwitchCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SettingsSwitchCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "SettingsSwitchCell.h"
10 |
11 | @implementation SettingsSwitchCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Libraries/MFLJoystick/MFLJoystick.h:
--------------------------------------------------------------------------------
1 | //
2 | // MFJoystick.h
3 | //
4 | //
5 | // Created by teejay on 5/14/13.
6 | // Copyright (c) 2013 teejay. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @protocol JoystickDelegate;
13 | @interface MFLJoystick : UIView
14 |
15 | @property CGFloat updateInterval;
16 | @property (weak) id delegate;
17 |
18 | - (void)setMovementUpdateInterval:(CGFloat)interval;
19 | - (void)setThumbImage:(UIImage *)thumbImage andBGImage:(UIImage *)bgImage;
20 | - (void)setMoveViscosity:(CGFloat)mv andSmallestValue:(CGFloat)sv;
21 |
22 | @end
23 |
24 | @protocol JoystickDelegate
25 | @optional
26 | - (void)joystick:(MFLJoystick *)aJoystick didUpdate:(CGPoint)movement;
27 | @end
--------------------------------------------------------------------------------
/BLEduinoTests/BLEduinoTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.kytelabs.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/BLEduinoTests/BLEduinoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // BLEduinoTests.m
3 | // BLEduinoTests
4 | //
5 | // Created by Ramon Gonzalez on 9/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BLEduinoTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation BLEduinoTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/23/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ConsoleCell.h"
10 |
11 | @implementation ConsoleCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)awakeFromNib
23 | {
24 | // Initialization code
25 | }
26 |
27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
28 | {
29 | [super setSelected:selected animated:animated];
30 |
31 | // Configure the view for the selected state
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/BLEduino/GameControllerViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // GameControllerViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDController.h"
12 | #import "BDBleduino.h"
13 | #import "MFLJoystick.h"
14 |
15 | @class GameControllerViewController;
16 | @protocol GameControllerViewControllerDelegate
17 | - (void)gameControllerModuleViewControllerDismissed:(GameControllerViewController *)controller;
18 | @end
19 |
20 | @interface GameControllerViewController : UIViewController
21 | <
22 | ControllerServiceDelegate,
23 | JoystickDelegate
24 | >
25 | @property (weak) id delegate;
26 | @property CGPoint lastPosition;
27 | - (void)dismissModule;
28 | @end
29 |
--------------------------------------------------------------------------------
/BLEduino/LCDTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LCDTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/22/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BDLeManager.h"
12 | #import "BDUart.h"
13 |
14 | @class LCDTableViewController;
15 | @protocol LCDTableViewControllerDelegate
16 | - (void)lcdModuleTableViewControllerDismissed:(LCDTableViewController *)controller;
17 | @end
18 |
19 | @interface LCDTableViewController : UITableViewController
20 | <
21 | UITextViewDelegate,
22 | UARTServiceDelegate
23 | >
24 | @property (weak) IBOutlet UITextView *messageView;
25 | @property (weak) IBOutlet UILabel *charCountView;
26 | @property (weak) id delegate;
27 | - (IBAction)dismissModule;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/BLEduino/KeyboardModuleTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KeyboardModuleTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/1/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDUart.h"
12 | #import "BDBleduino.h"
13 |
14 | @class KeyboardModuleTableViewController;
15 | @protocol KeyboardModuleTableViewControllerDelegate
16 | - (void)keyboardModuleTableViewControllerDismissed:(KeyboardModuleTableViewController *)controller;
17 | @end
18 |
19 | @interface KeyboardModuleTableViewController : UITableViewController
20 | <
21 | UITextViewDelegate,
22 | UARTServiceDelegate
23 | >
24 | @property (weak) IBOutlet UITextView *messageView;
25 | @property (weak) id delegate;
26 | - (IBAction)dismissModule;
27 | @end
28 |
--------------------------------------------------------------------------------
/BLEduino/PowerNextStateView.m:
--------------------------------------------------------------------------------
1 | //
2 | // PowerOtherStateView.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/25/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "PowerNextStateView.h"
10 |
11 | @implementation PowerNextStateView
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | /*
23 | // Only override drawRect: if you perform custom drawing.
24 | // An empty implementation adversely affects performance during animation.
25 | - (void)drawRect:(CGRect)rect
26 | {
27 | // Drawing code
28 | }
29 | */
30 |
31 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
32 | {
33 | BOOL state = (self.tag == 300)?YES:NO;
34 | [self.delegate powerOtherStateDidUpdateWithStateOn:state];
35 | }
36 | @end
37 |
--------------------------------------------------------------------------------
/BLEduino/PowerRelayViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // PowerRelayViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDFirmata.h"
12 | #import "PowerSwitchButtonView.h"
13 | #import "PowerNextStateView.h"
14 | #import "BDBleduino.h"
15 |
16 | @class PowerRelayViewController;
17 | @protocol PowerRelayViewControllerDelegate
18 | - (void)powerRelayModulViewControllerDismissed:(PowerRelayViewController *)controller;
19 | @end
20 |
21 | @interface PowerRelayViewController : UIViewController
22 | <
23 | CBPeripheralDelegate,
24 | FirmataServiceDelegate,
25 | PowerSwitchButtonViewDelegate,
26 | PowerNextStateViewDelegate
27 | >
28 | @property (weak) id delegate;
29 | @property BOOL isLastPowerRelayStateON;
30 | - (IBAction)dismissModule;
31 | @end
32 |
--------------------------------------------------------------------------------
/BLEduino/RadioControlledViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // RadioControlledViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDVehicleMotion.h"
12 | #import "BDBleduino.h"
13 | #import "VerticalJoystickControlView.h"
14 | #import "HorizontalJoystickControlView.h"
15 |
16 | @class RadioControlledViewController;
17 | @protocol RadioControlledViewControllerDelegate
18 | - (void)radioControlledModuleViewControllerDismissed:(RadioControlledViewController *)controller;
19 | @end
20 |
21 | @interface RadioControlledViewController : UIViewController
22 | <
23 | VehicleMotionServiceDelegate,
24 | VerticalJoystickControlViewDelegate,
25 | HorizontalJoystickControlViewDelegate
26 | >
27 | @property (weak) id delegate;
28 |
29 | - (IBAction)dismissModule;
30 | @end
31 |
32 |
33 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleEntries.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleEntries.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/22/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ConsoleEntries.h"
10 |
11 | @implementation ConsoleEntries
12 | - (NSString *)timeString
13 | {
14 | NSCalendar *calendar = [NSCalendar currentCalendar];
15 | NSDateComponents *components = [calendar components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:self.time];
16 |
17 | NSInteger hour = [components hour];
18 | NSString *period = (hour > 11)?@" PM":@" AM";
19 | NSString *dateFormat = ((hour > 0 && hour < 10) || (hour > 12 && hour < 22))?@"h:mm:ss":@"hh:mm:ss";
20 |
21 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
22 | [formatter setDateFormat:dateFormat];
23 | NSString *date = [formatter stringFromDate:self.time];
24 | date = [date stringByAppendingString:period];
25 | return date;
26 | }
27 | @end
28 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDQueue.m:
--------------------------------------------------------------------------------
1 | //
2 | // BDQueue.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/6/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDQueue.h"
10 |
11 | @interface BDQueue ()
12 | @property (strong) NSMutableArray *queue;
13 | @end
14 |
15 | @implementation BDQueue
16 |
17 | + (instancetype)queue
18 | {
19 | return [[BDQueue alloc] initWithCapacity:100];
20 | }
21 |
22 | - (id)initWithCapacity:(NSUInteger)capacity
23 | {
24 | if (self = [super init])
25 | {
26 | self.queue = [[NSMutableArray alloc] initWithCapacity:capacity];
27 | }
28 | return self;
29 | }
30 |
31 | - (void)enqueue:(id)object
32 | {
33 | [self.queue addObject:object];
34 | }
35 |
36 | - (id)dequeue
37 | {
38 | id headObject = [self.queue firstObject];
39 | if (headObject != nil)
40 | {
41 | [self.queue removeObjectAtIndex:0];
42 | }
43 |
44 | return headObject;
45 | }
46 |
47 | - (NSArray *)array
48 | {
49 | NSArray *values = [[NSArray alloc] initWithArray:self.queue];
50 | return values;
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/BLEduino/FirmataTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/12/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BDLeManager.h"
12 | #import "BDFirmata.h"
13 | #import "BDBleduino.h"
14 |
15 | @class FirmataTableViewController;
16 | @protocol FirmataTableViewControllerDelegate
17 | - (void) firmataTableViewControllerDismissed:(FirmataTableViewController *)controller;
18 | @end
19 |
20 | @interface FirmataTableViewController : UITableViewController
21 | <
22 | FirmataServiceDelegate,
23 | BleduinoDelegate,
24 | UIActionSheetDelegate,
25 | UIAlertViewDelegate,
26 | UITextFieldDelegate
27 | >
28 | @property (weak) id delegate;
29 | @property (strong, nonatomic) IBOutlet UIBarButtonItem *sync;
30 | @property (strong) NSArray *commands;
31 | @property (strong) BDBleduino *firmata;
32 | - (IBAction)sendData:(id)sender;
33 | - (IBAction)resetAllPins:(id)sender;
34 | - (IBAction)dismissModule;
35 | @end
36 |
--------------------------------------------------------------------------------
/BLEduino/RSSIAlertController.h:
--------------------------------------------------------------------------------
1 | //
2 | // RSSIDistanceAlertController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/9/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ProximityAlert.h"
11 |
12 | @class RSSIAlertController;
13 | @protocol RSSIAlertControllerDelegate
14 | - (void) rssiAlertControllerDismissed:(RSSIAlertController *)controller;
15 | - (void) didCreateRSSIAlert:(ProximityAlert *)alert
16 | fromController:(RSSIAlertController *)controller;
17 | - (void) didUpdateRSSIAlert:(ProximityAlert *)alert
18 | fromController:(RSSIAlertController *)controller;
19 | @end
20 |
21 | @interface RSSIAlertController : UITableViewController
22 | @property (weak) id delegate;
23 | @property ProximityAlert *alert;
24 | @property BOOL isNewAlert;
25 | @property IBOutlet UITextField *message;
26 | @property IBOutlet UISlider *rssiSlider;
27 | @property IBOutlet UILabel *rssiIndicator;
28 |
29 | - (IBAction)dismissModule:(id)sender;
30 | - (IBAction)updateRSSIAlert:(id)sender;
31 | @end
--------------------------------------------------------------------------------
/BLEduino-Libray/BleduinoController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BLEduinoTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/15/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #pragma mark -
13 | #pragma mark Bleduino Controller Protocol
14 | /****************************************************************************/
15 | /* Protocol */
16 | /****************************************************************************/
17 | @class BleduinoController;
18 | @protocol BleduinoControllerDelegate
19 | - (void)didUpateBleduino:(CBPeripheral *)bleduino controller:(BleduinoController *)controller;
20 | - (void)didDismissBleduinoController:(BleduinoController *)controller;
21 | @end
22 |
23 | @interface BleduinoController : UITableViewController
24 | @property (weak) id delegate;
25 | @property IBOutlet UITextField *bleduinoName;
26 | @property CBPeripheral *bleduino;
27 | - (IBAction) dismissModule:(id)sender;
28 | - (IBAction) updateBleduinoName:(id)sender;
29 | @end
30 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDNotificationAttributes.m:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationAttributesCharacteristic.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/11/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDNotificationAttributes.h"
10 |
11 | @implementation BDNotificationAttributes
12 |
13 | /*
14 | * Create Notification Attributes.
15 | */
16 | + (instancetype)attributes
17 | {
18 | return [[BDNotificationAttributes alloc] init];
19 | }
20 |
21 | /*
22 | * Create notification attributes characteristic from NSData object.
23 | */
24 | - (id) initWithData:(NSData *)attributesData
25 | {
26 | self = [super init];
27 | if(self)
28 | {
29 | _message = [[NSString alloc] initWithData:attributesData
30 | encoding:NSUTF8StringEncoding];
31 |
32 | }
33 |
34 | return self;
35 | }
36 |
37 | /*
38 | * Converts notification attributes characteristic to an NSData object to send data to a peripheral.
39 | */
40 | - (NSData *)data
41 | {
42 | NSData *attributesData = [self.message dataUsingEncoding:NSUTF8StringEncoding];
43 |
44 | return attributesData;
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/BLEduino/OrientationNavigationController.m:
--------------------------------------------------------------------------------
1 | //
2 | // OrientationNavigationController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/22/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "OrientationNavigationController.h"
10 |
11 | @interface OrientationNavigationController ()
12 |
13 | @end
14 |
15 | @implementation OrientationNavigationController
16 |
17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
18 | {
19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
20 | if (self) {
21 | // Custom initialization
22 | }
23 | return self;
24 | }
25 |
26 | - (void)viewDidLoad
27 | {
28 | [super viewDidLoad];
29 | // Do any additional setup after loading the view.
30 | }
31 |
32 | - (void)didReceiveMemoryWarning
33 | {
34 | [super didReceiveMemoryWarning];
35 | // Dispose of any resources that can be recreated.
36 | }
37 |
38 | //This module will only support portrait.
39 | - (NSUInteger)supportedInterfaceOrientations
40 | {
41 | return UIInterfaceOrientationMaskPortrait;
42 | }
43 |
44 | - (BOOL)shouldAutorotate
45 | {
46 | return NO;
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/16/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDLeManager.h"
11 | #import "BDUart.h"
12 | #import "BDBleduino.h"
13 | #import "PSPDFTextView.h"
14 |
15 | @class ConsoleTableViewController;
16 | @protocol ConsoleTableViewControllerDelegate
17 | - (void) consoleControllerDismissed:(ConsoleTableViewController *)controller;
18 | @end
19 |
20 | @interface ConsoleTableViewController : UITableViewController
21 | <
22 | UITextFieldDelegate,
23 | UITextViewDelegate,
24 | UARTServiceDelegate,
25 | BleduinoDelegate
26 | >
27 | @property (weak) id delegate;
28 | @property CGFloat keyboardHeight;
29 | @property CGFloat keyboardWidth;
30 | @property UITextField *consoleTextField;
31 | @property PSPDFTextView *consoleText;
32 | @property NSMutableArray *entries;
33 | @property UIColor *bleduinoTextColor;
34 | @property UIColor *iOSTextColor;
35 | @property NSMutableArray *consoleHub;
36 | - (IBAction)clear:(id)sender;
37 | - (IBAction)dismissModule:(id)sender;
38 | @end
39 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDNotificationAttributes.h:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationAttributesCharacteristic.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/11/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BDNotificationAttributes : NSObject
12 |
13 | //Notifications have two attributes: title and message;
14 | @property (strong) NSString *title;
15 | @property (strong) NSString *message;
16 |
17 | /*
18 | * Create Notification Attributes characteristic from NSData object.
19 | */
20 | - (id) initWithData:(NSData *)attributesData;
21 |
22 | /*
23 | * @method attributes
24 | *
25 | * @discussion This method requests subscription for notifications and verifies that
26 | * a specific characteristic/service is supported by the peripheral before
27 | * requesting subscription.
28 | *
29 | * @see @property startScanningForBleduinos
30 | *
31 | */
32 | + (instancetype)attributes;
33 |
34 | /*
35 | * Converts Notification Attributes characteristic to an NSData object to send data to a peripheral.
36 | */
37 | - (NSData *)data;
38 | @end
39 |
--------------------------------------------------------------------------------
/BLEduino/DistanceAlertController.h:
--------------------------------------------------------------------------------
1 | //
2 | // EditDistanceAlertController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/18/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ProximityAlert.h"
11 |
12 | @class DistanceAlertController;
13 | @protocol DistanceAlertControllerDelegate
14 | - (void) distanceAlertControllerDismissed:(DistanceAlertController *)controller;
15 | - (void) didCreateDistanceAlert:(ProximityAlert *)alert fromController:(DistanceAlertController *)controller;
16 | - (void) didUpdateDistanceAlert:(ProximityAlert *)alert fromController:(DistanceAlertController *)controller;
17 | @end
18 |
19 | @interface DistanceAlertController : UITableViewController
20 | @property (weak) id delegate;
21 | @property ProximityAlert *alert;
22 | @property BOOL isNewAlert;
23 | @property IBOutlet UITextField *message;
24 | @property IBOutlet UISegmentedControl *distanceControl;
25 | @property IBOutlet UISwitch *alertWhenCloser;
26 | @property IBOutlet UISwitch *alertWhenFarther;
27 |
28 | - (IBAction)dismissModule:(id)sender;
29 | - (IBAction)updateDistanceAlert:(id)sender;
30 | @end
31 |
--------------------------------------------------------------------------------
/BLEduino/FirmataAnalogCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataAnalogCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "FirmataAnalogCell.h"
10 |
11 | @implementation FirmataAnalogCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated
30 | {
31 | [super setEditing:editing animated:animated];
32 |
33 | //If not swipe-to-remove, then hide accesory appropietly.
34 | if(self.state != UITableViewCellStateShowingDeleteConfirmationMask)
35 | {
36 | self.pinValue.hidden = editing;
37 | }
38 | }
39 |
40 | - (void)willTransitionToState:(UITableViewCellStateMask)aState
41 | {
42 | [super willTransitionToState:aState];
43 | self.state = aState;
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/BLEduino/FirmataPWMCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataPWMCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "FirmataPWMCell.h"
10 |
11 | @implementation FirmataPWMCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
23 | {
24 | [super setSelected:selected animated:animated];
25 |
26 | // Configure the view for the selected state
27 | }
28 |
29 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated
30 | {
31 | [super setEditing:editing animated:animated];
32 |
33 | //If not swipe-to-remove, then hide accesory appropietly.
34 | if(self.state != UITableViewCellStateShowingDeleteConfirmationMask)
35 | {
36 | self.pinValue.hidden = editing;
37 | self.secondPinValue.hidden = editing;
38 | }
39 | }
40 |
41 | - (void)willTransitionToState:(UITableViewCellStateMask)aState
42 | {
43 | [super willTransitionToState:aState];
44 | self.state = aState;
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/BLEduino/FirmataDigitalCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataDigitalCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 12/16/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "FirmataDigitalCell.h"
10 |
11 | @implementation FirmataDigitalCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | self.shouldIndentWhileEditing = NO;
19 | }
20 | return self;
21 | }
22 |
23 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
24 | {
25 | [super setSelected:selected animated:animated];
26 |
27 | // Configure the view for the selected state
28 | }
29 |
30 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated
31 | {
32 | [super setEditing:editing animated:animated];
33 |
34 | //If not swipe-to-remove, then hide accesory appropietly.
35 | if(self.state != UITableViewCellStateShowingDeleteConfirmationMask)
36 | {
37 | self.pinValue.hidden = editing;
38 | }
39 | }
40 |
41 | - (void)willTransitionToState:(UITableViewCellStateMask)aState
42 | {
43 | [super willTransitionToState:aState];
44 | self.state = aState;
45 | }
46 |
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/BLEduino-Libray/LeDiscoveryTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LeDiscoveryTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BDLeManager.h"
12 | #import "BleduinoController.h"
13 |
14 | /****************************************************************************/
15 | /* Service & Characteristics */
16 | /****************************************************************************/
17 | extern NSString * const kUARTServiceUUIDString; //8C6BDA7A-A312-681D-025B-0032C0D16A2D UART Service
18 | extern NSString * const kRxCharacteristicUUIDString; //8C6BABCD-A312-681D-025B-0032C0D16A2D Read(Rx) Message Characteristic
19 | extern NSString * const kTxCharacteristicUUIDString; //8C6B1010-A312-681D-025B-0032C0D16A2D Write(Tx) Message Characteristic
20 |
21 |
22 | @interface LeDiscoveryTableViewController : UITableViewController
23 | <
24 | LeManagerDelegate,
25 | BleduinoControllerDelegate,
26 | UIAlertViewDelegate
27 | >
28 | @property (strong, nonatomic) NSMutableOrderedSet *connectedBleduinos;
29 | @property (strong, nonatomic) NSMutableOrderedSet *foundBleduinos;
30 | - (IBAction)showMenu;
31 | - (void)showStatusBar;
32 | @end
33 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDThrottleYawRollPitch.h:
--------------------------------------------------------------------------------
1 | //
2 | // Motion.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/4/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BDThrottleYawRollPitch : NSObject
12 | @property NSInteger throttle;
13 | @property NSInteger pitch;
14 | @property NSInteger roll;
15 | @property NSInteger yaw;
16 |
17 | /*
18 | * Create Throttle-Yaw-Roll-Pitch characteristic from NSData object.
19 | */
20 | - (id) initWithData:(NSData *)motionData;
21 |
22 | /*
23 | * @method bleduino:delegate:
24 | *
25 | * @param bleudino UUID for Service to write.
26 | * @param delegate UUID for Characteristic to write.
27 | *
28 | * @discussion This method requests subscription for notifications and verifies that
29 | * a specific characteristic/service is supported by the peripheral before
30 | * requesting subscription.
31 | *
32 | * @see startScanningForBleduinos
33 | * @see startScanningForBleDevices
34 | *
35 | */
36 | + (instancetype)motion;
37 |
38 | /*
39 | * Converts Throttle-Yaw-Roll-Pitch characteristic to an NSData object to send data to a peripheral.
40 | */
41 | - (NSData *)data;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/BLEduino/TimeDelayTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // TimeDelayTableViewCell.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/16/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "TimeDelayTableViewCell.h"
10 |
11 | @implementation TimeDelayTableViewCell
12 |
13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
14 | {
15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | - (void)awakeFromNib
23 | {
24 | // Initialization code
25 | }
26 |
27 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated
28 | {
29 | [super setSelected:selected animated:animated];
30 |
31 | // Configure the view for the selected state
32 | }
33 |
34 | - (void)setEditing:(BOOL)editing animated:(BOOL)animated
35 | {
36 | [super setEditing:editing animated:animated];
37 |
38 | //If not swipe-to-remove, then hide accesory appropietly.
39 | if(self.state != UITableViewCellStateShowingDeleteConfirmationMask)
40 | {
41 | self.delayValue.hidden = editing;
42 | self.secondDelayValue.hidden = editing;
43 | }
44 | }
45 |
46 | - (void)willTransitionToState:(UITableViewCellStateMask)aState
47 | {
48 | [super willTransitionToState:aState];
49 | self.state = aState;
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDProximity.h:
--------------------------------------------------------------------------------
1 | //
2 | // BDProximity.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/19/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | enum {
12 | Immediate = 4,
13 | VeryNear = 3,
14 | Near = 2,
15 | Far = 1,
16 | VeryFar = 0
17 | };
18 | typedef NSUInteger DistanceRange;
19 |
20 | @protocol ProximityDelegate
21 | @required
22 | - (void) bleduino:(CBPeripheral *)bleduino didUpdateValueForRange:(DistanceRange)range
23 | maxDistance:(NSNumber *)max
24 | minDistance:(NSNumber *)min
25 | withRSSI:(NSNumber *)RSSI;
26 |
27 | - (void) bleduino:(CBPeripheral *)bleduino didFinishCalibration:(NSNumber *)measuredPower;
28 |
29 | @optional
30 | - (void) bleduino:(CBPeripheral *)bleduino didFailToUpdateValueForDistanceWithError:(NSError *)error;
31 | @end
32 |
33 | @interface BDProximity : NSObject
34 | @property (weak) id delegate;
35 | @property CBPeripheral *monitoredBleduino;
36 | @property (strong) NSNumber *measuredPower; //Calibrated RSSI.
37 | @property float immediateRSSI;
38 | @property float nearRSSI;
39 | @property float farRSSI;
40 | @property float pathLoss; //Path Loss Exponent.
41 |
42 | + (id)sharedMonitor;
43 | - (void) startMonitoring;
44 | - (void) stopMonitoring;
45 | - (void) startCalibration;
46 | @end
47 |
--------------------------------------------------------------------------------
/BLEduino/ProximityViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ProximityViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/18/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "DistanceAlertController.h"
11 | #import "RSSIAlertController.h"
12 | #import "BDLeManager.h"
13 |
14 | @class ProximityViewController;
15 | @protocol ProximityViewControllerDelegate
16 | - (void) proximityControllerDismissed:(ProximityViewController *)controller;
17 | @end
18 |
19 | @interface ProximityViewController : UIViewController
20 | <
21 | UITableViewDelegate,
22 | UITableViewDataSource,
23 | UIAlertViewDelegate,
24 | UIActionSheetDelegate,
25 | DistanceAlertControllerDelegate,
26 | RSSIAlertControllerDelegate
27 | >
28 | @property (weak) id delegate;
29 | @property IBOutlet UITableView *tableView;
30 |
31 | //Distance
32 | @property IBOutlet UIImageView *distanceIndicator;
33 | @property NSString *distanceFormat;
34 |
35 | //Alerts
36 | @property NSInteger indexOfLastAlertUpdated;
37 | @property NSMutableArray *alerts;
38 |
39 | //Calibration
40 | @property IBOutlet UIActivityIndicatorView *calibrationIndicator;
41 | @property IBOutlet UILabel *calibrationLabel;
42 | @property IBOutlet UILabel *rangeLabel;
43 | @property IBOutlet UILabel *rssiLabel;
44 | @property IBOutlet UILabel *distanceLabel;
45 |
46 | - (IBAction)addAlert:(id)sender;
47 | - (IBAction)calibrate:(id)sender;
48 | - (IBAction)dismissModule:(id)sender;
49 | @end
50 |
--------------------------------------------------------------------------------
/Libraries/UIImage+ColorAtPixel/UIImage+ColorAtPixel.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009 Ole Begemann
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | /*
24 | UIImage+ColorAtPixel.h
25 |
26 | Created by Ole Begemann
27 | October, 2009
28 | */
29 |
30 | #import
31 |
32 | /*
33 | A category on UIImage that enables you to query the color value of arbitrary
34 | pixels of the image.
35 | */
36 | @interface UIImage (ColorAtPixel)
37 |
38 | - (UIColor *)colorAtPixel:(CGPoint)point;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/BLEduino/SequencerTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SequencerTableViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 6/13/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BDLeManager.h"
12 | #import "BDFirmata.h"
13 | #import "BDFirmataCommand.h"
14 | #import "BDBleduino.h"
15 |
16 | #import "FirmataAnalogCell.h"
17 | #import "FirmataDigitalCell.h"
18 | #import "FirmataPWMCell.h"
19 | #import "TimeDelayTableViewCell.h"
20 |
21 | @class SequencerTableViewController;
22 | @protocol SequencerTableViewControllerDelegate
23 | - (void) sequencerTableViewControllerDismissed:(SequencerTableViewController *)controller;
24 | @end
25 |
26 | @interface SequencerTableViewController : UITableViewController
27 | <
28 | FirmataServiceDelegate,
29 | BleduinoDelegate,
30 | UIActionSheetDelegate,
31 | UIAlertViewDelegate,
32 | UITextFieldDelegate
33 | >
34 | @property (weak) id delegate;
35 | @property (strong) NSMutableArray *sequence;
36 | @property (strong) BDBleduino *firmata;
37 | @property (strong) BDFirmataCommand *start;
38 | @property (strong) BDFirmataCommand *end;
39 | @property IBOutlet UIBarButtonItem *edit;
40 | @property IBOutlet UIBarButtonItem *addCommand;
41 | @property IBOutlet UIBarButtonItem *addDelay;
42 |
43 | - (IBAction)addCommand:(id)sender;
44 | - (IBAction)addDelay:(id)sender;
45 | - (IBAction)sendSequence:(id)sender;
46 | - (IBAction)editSequence:(id)sender;
47 | - (IBAction)dismissModule;
48 | @end
49 |
--------------------------------------------------------------------------------
/Libraries/RESideMenu/UIViewController+RESideMenu.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+RESideMenu.h
3 | // RESideMenu
4 | //
5 | // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import
27 |
28 | @class RESideMenu;
29 |
30 | @interface UIViewController (RESideMenu)
31 |
32 | @property (strong, readonly, nonatomic) RESideMenu *sideMenuViewController;
33 |
34 | - (void)re_displayController:(UIViewController *)controller frame:(CGRect)frame;
35 | - (void)re_hideController:(UIViewController *)controller;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDButtonAction.h:
--------------------------------------------------------------------------------
1 | //
2 | // ButtonActionCharacteristic.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/10/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BDButtonAction : NSObject
12 |
13 | /*
14 | * Identifies the button.
15 | */
16 | @property NSInteger buttonID;
17 |
18 | /*
19 | * For push buttons.
20 | * State: 1 denotes pushed down.
21 | * State: 0 denotes neutral
22 | */
23 | @property NSInteger buttonStatus;
24 |
25 | /*
26 | * For joystick buttons.
27 | * Resolution: -90 < X < 90
28 | * State: -90 denotes completely pushed down, represented as 0.
29 | * State: 90 denotes completely pushed up, represented as 254.
30 | * State: 0 denotes neutral, represented as 127.
31 | * State: -90 < X < 0 denotes down, represented as 0 < X < 127.
32 | * State: 0 < X < 90 denotes up, represented as 127 < X < 255.
33 | */
34 | @property NSInteger buttonValue;
35 |
36 | /*
37 | * Create button action characteristic from NSData object.
38 | */
39 | - (id) initWithData:(NSData *)buttonActionData;
40 |
41 | /*
42 | * @method bleduino:delegate:
43 | *
44 | * @param bleudino UUID for Service to write.
45 | * @param delegate UUID for Characteristic to write.
46 | *
47 | * @discussion This method requests subscription for notifications and verifies that
48 | * a specific characteristic/service is supported by the peripheral before
49 | * requesting subscription.
50 | *
51 | * @see startScanningForBleduinos
52 | * @see startScanningForBleDevices
53 | *
54 | */
55 | + (instancetype)action;
56 |
57 | /*
58 | * Converts button action characteristic to an NSData object to send data to a peripheral.
59 | */
60 | - (NSData *)data;
61 | @end
62 |
--------------------------------------------------------------------------------
/Libraries/RESideMenu/RECommonFunctions.h:
--------------------------------------------------------------------------------
1 | //
2 | // RECommonFunctions.h
3 | // RESideMenu
4 | //
5 | // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import
27 |
28 | #ifndef REUIKitIsFlatModeFunction
29 | #define REUIKitIsFlatModeFunction
30 | BOOL REUIKitIsFlatMode();
31 | #endif
32 |
33 | #ifndef kCFCoreFoundationVersionNumber_iOS_6_1
34 | #define kCFCoreFoundationVersionNumber_iOS_6_1 793.00
35 | #endif
36 |
37 | #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
38 | #define IF_IOS7_OR_GREATER(...) \
39 | if (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_6_1) \
40 | { \
41 | __VA_ARGS__ \
42 | }
43 | #else
44 | #define IF_IOS7_OR_GREATER(...)
45 | #endif
46 |
47 | BOOL REDeviceIsUIKit7() __attribute__ ((deprecated));
--------------------------------------------------------------------------------
/Libraries/OBShapedButton/OBShapedButton.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009 Ole Begemann
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | /*
24 | OBShapedButton.h
25 |
26 | Created by Ole Begemann
27 | October, 2009
28 | */
29 |
30 | /*
31 | OBShapedButton is a UIButton subclass optimized for non-rectangular button shapes.
32 | Instances of OBShapedButton respond to touches only in areas where the image that is
33 | assigned to the button for UIControlStateNormal is non-transparent.
34 | */
35 |
36 | #import
37 |
38 | // -[UIView hitTest:withEvent: ignores views that an alpha level less than 0.1.
39 | // So we will do the same and treat pixels with alpha < 0.1 as transparent.
40 | #define kAlphaVisibleThreshold (0.1f)
41 |
42 | @interface OBShapedButton : UIButton
43 |
44 | // Class interface is empty. OBShapedButton does not add new public methods.
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/BLEduino/ModulesCollectionViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ModulesCollectionViewController.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/1/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //Modules
12 | #import "BDLeManager.h"
13 | #import "LCDTableViewController.h"
14 | #import "KeyboardModuleTableViewController.h"
15 | #import "GameControllerViewController.h"
16 | #import "RadioControlledViewController.h"
17 | #import "PowerRelayViewController.h"
18 | #import "LEDModuleTableViewController.h"
19 | #import "BDNotification.h"
20 | #import "BDBridge.h"
21 | #import "FirmataTableViewController.h"
22 | #import "SequencerTableViewController.h"
23 | #import "ProximityViewController.h"
24 | #import "ConsoleTableViewController.h"
25 | #import "BDNotifications.h"
26 | #import "BDProximity.h"
27 |
28 | @interface ModulesCollectionViewController : UICollectionViewController
29 | <
30 | UICollectionViewDelegateFlowLayout,
31 | CBPeripheralDelegate,
32 | UIAlertViewDelegate,
33 | LCDTableViewControllerDelegate,
34 | KeyboardModuleTableViewControllerDelegate,
35 | GameControllerViewControllerDelegate,
36 | RadioControlledViewControllerDelegate,
37 | PowerRelayViewControllerDelegate,
38 | LEDModuleTableViewControllerDelegate,
39 | FirmataTableViewControllerDelegate,
40 | SequencerTableViewControllerDelegate,
41 | ProximityViewControllerDelegate,
42 | ConsoleTableViewControllerDelegate,
43 | BridgeDelegate,
44 | NotificationsDelegate
45 | >
46 | @property (nonatomic, strong) NSArray *modules;
47 | @property (nonatomic, strong) NSArray *modulesImages;
48 |
49 | //Services that run in the background.
50 | @property (strong) BDBridge *bleBridge;
51 | @property (strong) BDNotifications *notifications;
52 | @property (strong) BDProximity *proximityMonitor;
53 |
54 | //Proximity
55 | @property (strong) NSMutableArray *distanceAlerts;
56 | @property BOOL distanceAlertsEnabled;
57 |
58 | - (IBAction)showMenu;
59 | - (void)showStatusBar;
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDNotifications.h:
--------------------------------------------------------------------------------
1 | //
2 | // BDNotifications.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/26/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 | #import "BDNotification.h"
11 |
12 | #pragma mark -
13 | #pragma mark Notifications Protocol
14 | /****************************************************************************/
15 | /* Protocol */
16 | /****************************************************************************/
17 | @class BDNotifications;
18 | @protocol NotificationsDelegate
19 | @required
20 | - (void)didStartListening:(BDNotifications *)service;
21 | - (void)didFailToStartListening:(BDNotifications *)service;
22 | @end
23 |
24 | /****************************************************************************/
25 | /* Notification Service */
26 | /****************************************************************************/
27 | @interface BDNotifications : NSObject
28 | @property BOOL isListening;
29 |
30 | /*
31 | * @method startListening
32 | *
33 | * @discussion This method subscribes the iOS device to the Notification service for each
34 | * connected BLEduino. Then listens to incoming data, upon reciving
35 | * data the iOS device then pushes a local notification.
36 | *
37 | */
38 | - (void)startListeningWithDelegate:(id)aController;
39 | /*
40 | * @method stopListening
41 | *
42 | * @discussion This method unsubscribes the iOS device from the Notification service for
43 | * each connected BLEduinos. That is, it stops listening altogether.
44 | *
45 | */
46 | - (void)stopListening;
47 |
48 |
49 | /****************************************************************************/
50 | /* Access to notificication listener instance */
51 | /****************************************************************************/
52 | + (BDNotifications *)sharedListener;
53 |
54 | @end
55 |
56 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDBridge.h:
--------------------------------------------------------------------------------
1 | //
2 | // BleBridgeService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 | #import "BDBleBridge.h"
11 |
12 | #pragma mark -
13 | #pragma mark Notification Service Protocol
14 | /****************************************************************************/
15 | /* Protocol */
16 | /****************************************************************************/
17 | @class BDBridge;
18 | @protocol BridgeDelegate
19 | @required
20 | - (void)didOpenBridge:(BDBridge *)service;
21 | - (void)didFailToOpenBridge:(BDBridge *)service;
22 | @optional
23 | - (void)didFailToKeepBridgeOpen:(BDBridge *)service;
24 | @end
25 |
26 | @interface BDBridge : NSObject
27 | @property BOOL isOpen;
28 |
29 | /*
30 | * @method openBridge
31 | *
32 | * @param aController The controller that will serve as the delegate for the BDBrige oject. This delegate
33 | * will get notified when and if the ble bridge was opened successful.
34 | *
35 | * @discussion This method subscribes the iOS device to the BLE Bridge service
36 | * (Bridge Tx and Bridge RX Characteristic) for each connected BLEduinos.
37 | * Then listens to incoming data, upon reciving data the iOS device then
38 | * relays the data to the corresponsing BLEduino.
39 | *
40 | */
41 | - (void)openBridgeWithDelegate:(id )aController;
42 |
43 | /*
44 | * @method closeBridge
45 | *
46 | * @discussion This method unsubscribes the iOS device from the BDBridge service for
47 | * each connected BLEduino. That is, stops listening altogether.
48 | *
49 | */
50 | - (void)closeBridge;
51 |
52 | /****************************************************************************/
53 | /* Access to Ble Bridge instance */
54 | /****************************************************************************/
55 | + (BDBridge *)sharedBridge;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/BLEduino/ConsoleNavigationViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleNavigationViewController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/4/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ConsoleNavigationViewController.h"
10 |
11 | @interface ConsoleNavigationViewController ()
12 |
13 | @end
14 |
15 | @implementation ConsoleNavigationViewController
16 |
17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
18 | {
19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
20 | if (self) {
21 | // Custom initialization
22 | }
23 | return self;
24 | }
25 |
26 | - (void)viewDidLoad
27 | {
28 | [super viewDidLoad];
29 | // Do any additional setup after loading the view.
30 | NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
31 | [center addObserver:self selector:@selector(keyboardOnScreen:) name:UIKeyboardWillShowNotification object:nil];
32 | }
33 |
34 | - (void)viewWillDisappear:(BOOL)animated
35 | {
36 | UIView *consoleTextFieldView = [self.view viewWithTag:2013];
37 |
38 | [UIView beginAnimations:@"Remove TextField" context:nil];
39 | [consoleTextFieldView removeFromSuperview];
40 | [UIView commitAnimations];
41 | }
42 |
43 | - (void)keyboardOnScreen:(NSNotification *)notification
44 | {
45 | NSDictionary *info = notification.userInfo;
46 | NSValue *value = info[UIKeyboardFrameEndUserInfoKey];
47 |
48 | CGRect rawFrame = [value CGRectValue];
49 | CGRect keyboardFrame = [self.view convertRect:rawFrame fromView:nil];
50 | CGFloat keyboardHeight = keyboardFrame.size.height;
51 |
52 | //Update textfield location.
53 | UIView *consoleTextFieldView = [self.view viewWithTag:2013];
54 | CGFloat height = consoleTextFieldView.frame.size.height;
55 | CGFloat width = consoleTextFieldView.frame.size.width;
56 | CGFloat y = self.view.frame.size.height - keyboardHeight - height;
57 | [consoleTextFieldView setFrame:CGRectMake(0, y, width, height)];
58 | }
59 |
60 | - (void)didReceiveMemoryWarning
61 | {
62 | [super didReceiveMemoryWarning];
63 | // Dispose of any resources that can be recreated.
64 | }
65 |
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/Libraries/RESideMenu/RECommonFunctions.m:
--------------------------------------------------------------------------------
1 | //
2 | // RECommonFunctions.m
3 | // RESideMenu
4 | //
5 | // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import "RECommonFunctions.h"
27 |
28 | BOOL REDeviceIsUIKit7()
29 | {
30 | return REUIKitIsFlatMode();
31 | }
32 |
33 | BOOL REUIKitIsFlatMode()
34 | {
35 | static BOOL isUIKitFlatMode = NO;
36 | static dispatch_once_t onceToken;
37 | dispatch_once(&onceToken, ^{
38 | if (floor(NSFoundationVersionNumber) > 993.0) {
39 | // If your app is running in legacy mode, tintColor will be nil - else it must be set to some color.
40 | if (UIApplication.sharedApplication.keyWindow) {
41 | isUIKitFlatMode = [UIApplication.sharedApplication.delegate.window performSelector:@selector(tintColor)] != nil;
42 | } else {
43 | // Possible that we're called early on (e.g. when used in a Storyboard). Adapt and use a temporary window.
44 | isUIKitFlatMode = [[UIWindow new] performSelector:@selector(tintColor)] != nil;
45 | }
46 | }
47 | });
48 | return isUIKitFlatMode;
49 | }
--------------------------------------------------------------------------------
/BLEduino-Libray/BDFirmataCommand.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataCommandCharacteristic.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/6/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*
12 |
13 | ## Pin Numbers
14 |
15 | Pin numbers are set according to the [pin definition for Arduino.]
16 | (https://github.com/BLEduino/bleduino-firmware/blob/master/hardware/BLEduino/variants/BLEduino/pins_arduino.h/ )
17 |
18 | */
19 |
20 |
21 | enum {
22 | FirmataCommandPinStateOutput = 0,
23 | FirmataCommandPinStateInput = 1,
24 | FirmataCommandPinStateAnalog = 2,
25 | FirmataCommandPinStatePWM = 3
26 |
27 | //Work-around, only for sequencer module.
28 | //Begining (of sequence) = 4
29 | //End (of sequence) = 5
30 | //Time delay in seconds = 6
31 | //Time delay in minutes = 7
32 | };
33 | typedef NSUInteger FirmataCommandPinState;
34 |
35 | @interface BDFirmataCommand : NSObject
36 | @property FirmataCommandPinState pinState;
37 | @property NSInteger pinNumber;
38 | @property NSInteger pinValue;
39 |
40 |
41 | /*
42 | * Create Firmata Command.
43 | */
44 | - (id) initWithPinState:(FirmataCommandPinState)state
45 | pinNumber:(NSInteger)number
46 | pinValue:(NSInteger)value;
47 |
48 | /*
49 | * Create Firmata Command.
50 | */
51 | + (id) commandPinState:(FirmataCommandPinState)state
52 | pinNumber:(NSInteger)number
53 | pinValue:(NSInteger)value;
54 |
55 | /*
56 | * @method bleduino:delegate:
57 | *
58 | * @param bleudino UUID for Service to write.
59 | * @param delegate UUID for Characteristic to write.
60 | *
61 | * @discussion This method requests subscription for notifications and verifies that
62 | * a specific characteristic/service is supported by the peripheral before
63 | * requesting subscription.
64 | *
65 | * @see startScanningForBleduinos
66 | * @see startScanningForBleDevices
67 | *
68 | */
69 | + (instancetype)command;
70 |
71 | /*
72 | * Create Firmata Command characteristic from NSData object.
73 | */
74 | - (id) initWithData:(NSData *)firmataData;
75 |
76 | /*
77 | * Converts Firmata Command characteristic to an NSData object to send data to a peripheral.
78 | */
79 | - (NSData *)data;
80 |
81 | @end
82 |
--------------------------------------------------------------------------------
/Libraries/RESideMenu/UIViewController+RESideMenu.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+RESideMenu.m
3 | // RESideMenu
4 | //
5 | // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import "UIViewController+RESideMenu.h"
27 | #import "RESideMenu.h"
28 |
29 | @implementation UIViewController (REFrostedViewController)
30 |
31 | - (void)re_displayController:(UIViewController *)controller frame:(CGRect)frame
32 | {
33 | [self addChildViewController:controller];
34 | controller.view.frame = frame;
35 | [self.view addSubview:controller.view];
36 | [controller didMoveToParentViewController:self];
37 | }
38 |
39 | - (void)re_hideController:(UIViewController *)controller
40 | {
41 | [controller willMoveToParentViewController:nil];
42 | [controller.view removeFromSuperview];
43 | [controller removeFromParentViewController];
44 | }
45 |
46 | - (RESideMenu *)sideMenuViewController
47 | {
48 | UIViewController *iter = self.parentViewController;
49 | while (iter) {
50 | if ([iter isKindOfClass:[RESideMenu class]]) {
51 | return (RESideMenu *)iter;
52 | } else if (iter.parentViewController && iter.parentViewController != iter) {
53 | iter = iter.parentViewController;
54 | } else {
55 | iter = nil;
56 | }
57 | }
58 | return nil;
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ControllerService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 | #import "BDButtonAction.h"
11 |
12 | #pragma mark -
13 | #pragma mark Controller Service UUIDs
14 | /****************************************************************************/
15 | /* Service & Characteristics */
16 | /****************************************************************************/
17 | extern NSString * const kControllerServiceUUIDString;
18 | //8C6BF001-A312-681D-025B-0032C0D16A2D Controller Service
19 |
20 | extern NSString * const kButtonActionCharacteristicUUIDString;
21 | //8C6BD00D-A312-681D-025B-0032C0D16A2D Button Action Characteristic
22 |
23 |
24 | #pragma mark -
25 | #pragma mark Controller Service Protocol
26 | /****************************************************************************/
27 | /* Protocol */
28 | /****************************************************************************/
29 | @class BDController;
30 | @protocol ControllerServiceDelegate
31 | @optional
32 | - (void)controllerService:(BDController *)service
33 | didReceiveButtonAction:(BDButtonAction *)buttonAction
34 | error:(NSError *)error;
35 |
36 | - (void)controllerService:(BDController *)service
37 | didWriteButtonAction:(BDButtonAction *)buttonAction
38 | error:(NSError *)error;
39 |
40 | - (void)didSubscribeToStartReceivingButtonActionsFor:(BDController *)service error:(NSError *)error;
41 | - (void)didUnsubscribeToStopRecivingButtonActionsFor:(BDController *)service error:(NSError *)error;
42 | @end
43 |
44 | /****************************************************************************/
45 | /* Controller Service */
46 | /****************************************************************************/
47 | @interface BDController : BDObject
48 | @property (nonatomic, strong) BDButtonAction *lastButtonAction;
49 |
50 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
51 | delegate:(id)aController;
52 |
53 | #pragma mark -
54 | #pragma mark Writing to BLEduino
55 | // Write button actions to BLEduino.
56 | - (void) writeButtonAction:(BDButtonAction *)buttonAction withAck:(BOOL)enabled;
57 | - (void) writeButtonAction:(BDButtonAction *)buttonAction;
58 |
59 | #pragma mark -
60 | #pragma mark Reading from BLEduino
61 | // Read/Receiving button actions from BLEduino.
62 | - (void) readButtonAction;
63 | - (void) subscribeToStartReceivingButtonActions;
64 | - (void) unsubscribeToStopReiceivingButtonActions;
65 |
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDFirmata.h:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 | #import "BDFirmataCommand.h"
11 |
12 | #pragma mark -
13 | #pragma mark Firmata Service UUIDs
14 | /****************************************************************************/
15 | /* Service & Characteristics */
16 | /****************************************************************************/
17 | extern NSString * const kFirmataServiceUUIDString;
18 | //8C6B1ED1-A312-681D-025B-0032C0D16A2D Firmata Service
19 |
20 | extern NSString * const kFirmataCommandCharacteristicUUIDString;
21 | //8C6B2551-A312-681D-025B-0032C0D16A2D Firmata Command Characteristic
22 |
23 | #pragma mark -
24 | #pragma mark Vehicle Motion Service Protocol
25 | /****************************************************************************/
26 | /* Protocol */
27 | /****************************************************************************/
28 | @class BDFirmata;
29 | @protocol FirmataServiceDelegate
30 | @optional
31 | - (void) firmataService:(BDFirmata *)service
32 | didWriteFirmataCommand:(BDFirmataCommand *)firmataCommand
33 | error:(NSError *)error;
34 |
35 | - (void) firmataService:(BDFirmata *)service
36 | didReceiveFirmataCommand:(BDFirmataCommand *)firmataCommand
37 | error:(NSError *)error;
38 |
39 | - (void)didSubscribeToStartReceivingFirmataCommandsFor:(BDFirmata *)service error:(NSError *)error;
40 | - (void)didUnsubscribeToStopReceivingFirmataCommandsFor:(BDFirmata *)service error:(NSError *)error;
41 | @end
42 |
43 | /****************************************************************************/
44 | /* Firmata Service */
45 | /****************************************************************************/
46 | @interface BDFirmata : BDObject
47 | @property (nonatomic, strong) BDFirmataCommand *lastSentFirmataCommand;
48 | @property (nonatomic, strong) BDFirmataCommand *lastReceivedFirmataCommand;
49 |
50 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
51 | delegate:(id)aController;
52 |
53 | #pragma mark -
54 | #pragma mark Writing to BLEduino
55 | // Write firmata command to BLEduino.
56 | - (void) writeFirmataCommand:(BDFirmataCommand *)firmataCommand withAck:(BOOL)enabled;
57 | - (void) writeFirmataCommand:(BDFirmataCommand *)firmataCommand;
58 |
59 | #pragma mark -
60 | #pragma mark Reading from BLEduino
61 | // Read/Receiving firmata command from BLEduino.
62 | - (void) readFirmataCommand;
63 | - (void) subscribeToStartReceivingFirmataCommands;
64 | - (void) unsubscribeToStopReiceivingFirmataCommands;
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDButtonAction.m:
--------------------------------------------------------------------------------
1 | //
2 | // ButtonActionCharacteristic.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/10/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDButtonAction.h"
10 |
11 | @implementation BDButtonAction
12 |
13 | /*
14 | * Create Button Action.
15 | */
16 | + (instancetype)action
17 | {
18 | return [[BDButtonAction alloc] init];
19 | }
20 |
21 | /*
22 | * Create Button Action characteristic from NSData object.
23 | */
24 | - (id) initWithData:(NSData *)buttonActionData
25 | {
26 | self = [super init];
27 | if (self)
28 | {
29 | Byte *buttonIDByte = (Byte*)malloc(1);
30 | NSRange buttonIDRange = NSMakeRange(0, 1);
31 | [buttonActionData getBytes:buttonIDByte range:buttonIDRange];
32 | NSData *buttonIDData = [[NSData alloc] initWithBytes:buttonIDByte length:1];
33 | _buttonID = *(int*)([buttonIDData bytes]);
34 | free(buttonIDByte);
35 |
36 | Byte *buttonStatusByte = (Byte*)malloc(1);
37 | NSRange buttonStatusRange = NSMakeRange(1, 1);
38 | [buttonActionData getBytes:buttonStatusByte range:buttonStatusRange];
39 | NSData *buttonStatusData = [[NSData alloc] initWithBytes:buttonStatusByte length:1];
40 | _buttonStatus = *(int*)([buttonStatusData bytes]);
41 | free(buttonStatusByte);
42 |
43 | Byte *buttonValueByte = (Byte*)malloc(1);
44 | NSRange buttonValueRange = NSMakeRange(2, 1);
45 | [buttonActionData getBytes:buttonValueByte range:buttonValueRange];
46 | NSData *buttonValueData = [[NSData alloc] initWithBytes:buttonValueByte length:1];
47 | _buttonValue = *(int*)([buttonValueData bytes]);
48 | free(buttonValueByte);
49 | }
50 |
51 | return self;
52 | }
53 |
54 | /*
55 | * Converts Button Action characteristic to an NSData object to send data to a peripheral.
56 | */
57 | - (NSData *)data
58 | {
59 | NSMutableData *buttonActionData = [[NSMutableData alloc] initWithCapacity:4];
60 |
61 | Byte buttonIDByte = (self.buttonID >> (0)) & 0xff;
62 | NSMutableData *buttonIDData = [NSMutableData dataWithBytes:&buttonIDByte length:sizeof(buttonIDByte)];
63 | [buttonActionData appendData:buttonIDData];
64 |
65 | Byte buttonStatusByte = (self.buttonStatus >> (0)) & 0xff;
66 | NSMutableData *buttonStatusData = [NSMutableData dataWithBytes:&buttonStatusByte length:sizeof(buttonStatusByte)];
67 | [buttonActionData appendData:buttonStatusData];
68 |
69 | Byte buttonValueByte = (self.buttonValue >> (0)) & 0xff;
70 | NSMutableData *buttonValueData = [NSMutableData dataWithBytes:&buttonValueByte length:sizeof(buttonValueByte)];
71 | [buttonActionData appendData:buttonValueData];
72 |
73 | return buttonActionData;
74 | }
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDVehicleMotion.h:
--------------------------------------------------------------------------------
1 | //
2 | // VehicleMotionService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BDObject.h"
11 | #import "BDThrottleYawRollPitch.h"
12 |
13 | #pragma mark -
14 | #pragma mark Vehicle Motion Service UUIDs
15 | /****************************************************************************/
16 | /* Service & Characteristics */
17 | /****************************************************************************/
18 | extern NSString * const kVehicleMotionServiceUUIDString;
19 | //8C6B1125-A312-681D-025B-0032C0D16A2D VehicleMotion Service
20 |
21 | extern NSString * const kThrottleYawRollPitchCharacteristicUUIDString;
22 | //8C6B9806-A312-681D-025B-0032C0D16A2D Throttle-Yaw-Roll-Pitch Characteristic
23 |
24 |
25 | #pragma mark -
26 | #pragma mark Vehicle Motion Service Protocol
27 | /****************************************************************************/
28 | /* Protocol */
29 | /****************************************************************************/
30 | @class BDVehicleMotion;
31 | @protocol VehicleMotionServiceDelegate
32 | @optional
33 | - (void)vehicleMotionService:(BDVehicleMotion *)service
34 | didReceiveMotion:(BDThrottleYawRollPitch *)motionUpdate
35 | error:(NSError *)error;
36 |
37 | - (void)vehicleMotionService:(BDVehicleMotion *)service
38 | didWriteMotion:(BDThrottleYawRollPitch *)motionUpdate
39 | error:(NSError *)error;
40 |
41 | - (void)didSubscribeToStartReceivingMotionUpdatesFor:(BDVehicleMotion *)service error:(NSError *)error;
42 | - (void)didUnsubscribeToStopRecivingMotionUpdatesFor:(BDVehicleMotion *)service error:(NSError *)error;
43 | @end
44 |
45 | /****************************************************************************/
46 | /* Vehicle Motion Service */
47 | /****************************************************************************/
48 | @interface BDVehicleMotion : BDObject
49 | @property (nonatomic, strong) BDThrottleYawRollPitch *lastMotionUpdate;
50 |
51 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
52 | delegate:(id)aController;
53 |
54 | #pragma mark -
55 | #pragma mark Writing to BLEduino
56 | // Write motion update to BLEduino.
57 | - (void) writeMotionUpdate:(BDThrottleYawRollPitch *)motion withAck:(BOOL)enabled;
58 | - (void) writeMotionUpdate:(BDThrottleYawRollPitch *)motion;
59 |
60 | #pragma mark -
61 | #pragma mark Reading from BLEduino
62 | // Read/Receiving motion update from BLEduino.
63 | - (void) readMotionUpdate;
64 | - (void) subscribeToStartReceivingMotionUpdates;
65 | - (void) unsubscribeToStopReiceivingMotionUpdates;
66 |
67 |
68 | @end
69 |
70 |
71 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDBleBridge.h:
--------------------------------------------------------------------------------
1 | //
2 | // BDBleBridgeService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/25/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 |
11 | #pragma mark -
12 | #pragma mark BLE Bridge Service UUIDs
13 | /****************************************************************************/
14 | /* Service & Characteristics */
15 | /****************************************************************************/
16 | extern NSString * const kBleBridgeServiceUUIDString;
17 | //8C6BB1EB-A312-681D-025B-0032C0D16A2D BLE Bridge Service
18 |
19 | extern NSString * const kBridgeRxCharacteristicUUIDString;
20 | //8C6B5778-A312-681D-025B-0032C0D16A2D Bridge Read (Rx) Characteristic
21 |
22 | extern NSString * const kBridgeTxCharacteristicUUIDString;
23 | //8C6B454B-A312-681D-025B-0032C0D16A2D Bridge Write (Tx) Characteristic
24 |
25 | extern NSString * const kDeviceIDCharacteristicUUIDString;
26 | //8C6BD1D0-A312-681D-025B-0032C0D16A2D Device ID Characteristic
27 |
28 | #pragma mark -
29 | #pragma mark Notification Service Protocol
30 | /****************************************************************************/
31 | /* Protocol */
32 | /****************************************************************************/
33 | @class BDBleBridge;
34 | @protocol BleBridgeServiceDelegate
35 |
36 | - (void)bridgeService:(BDBleBridge *)service didReceiveDeviceID:(NSInteger)deviceID error:(NSError *)error;
37 | - (void)bridgeService:(BDBleBridge *)service didReceiveData:(NSData *)data error:(NSError *)error;
38 | - (void)bridgeService:(BDBleBridge *)service didWriteData:(NSData *)data error:(NSError *)error;
39 | - (void)bridgeService:(BDBleBridge *)service didWriteDeviceID:(NSInteger)deviceID error:(NSError *)error;
40 |
41 | - (void)didSubscribeToReceiveBridgeMessagesFor:(BDBleBridge *)service error:(NSError *)error;
42 | - (void)didUnsubscribeToReceiveBridgeMessagesFor:(BDBleBridge *)service error:(NSError *)error;
43 |
44 | @end
45 | @interface BDBleBridge : BDObject
46 |
47 | @property (strong) NSData *dataSent;
48 | @property (strong) NSData *dataReceived;
49 | @property NSInteger deviceID;
50 |
51 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
52 | delegate:(id)aController;
53 |
54 | #pragma mark -
55 | #pragma mark Writing to BLEduino
56 | // Writing data to BLEduino.
57 | - (void) writeDeviceID:(NSInteger)deviceID withAck:(BOOL)enabled;
58 | - (void) writeDeviceID:(NSInteger)deviceID;
59 |
60 | - (void) writeData:(NSData *)data withAck:(BOOL)enabled;
61 | - (void) writeData:(NSData *)data;
62 |
63 | #pragma mark -
64 | #pragma mark Reading from BLEduino
65 | // Read/Receive data from BLEduino.
66 | - (void) readDeviceID;
67 | - (void) readData;
68 | - (void) subscribeToStartReceivingBridgeData;
69 | - (void) unsubscribeToStopReiceivingBridgeData;
70 | @end
71 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDNotification.h:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/3/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDObject.h"
10 | #import "BDNotificationAttributes.h"
11 |
12 | #pragma mark -
13 | #pragma mark Notification Service UUIDs
14 | /****************************************************************************/
15 | /* Service & Characteristics */
16 | /****************************************************************************/
17 | extern NSString * const kNotificationServiceUUIDString;
18 | //8C6B3141-A312-681D-025B-0032C0D16A2D Notification Service
19 |
20 | extern NSString * const kNotificationAttributesCharacteristicUUIDString;
21 | //8C6B1618-A312-681D-025B-0032C0D16A2D Notification Attributes Characteristic
22 |
23 |
24 | #pragma mark -
25 | #pragma mark Notification Service Protocol
26 | /****************************************************************************/
27 | /* Protocol */
28 | /****************************************************************************/
29 | @class BDNotification;
30 | @protocol NotificationServiceDelegate
31 | @required
32 | - (void)notificationService:(BDNotification *)service
33 | didReceiveNotification:(BDNotificationAttributes *)notification
34 | error:(NSError *)error;
35 |
36 | - (void)notificationService:(BDNotification *)service
37 | didWriteNotification:(BDNotificationAttributes *)notification
38 | error:(NSError *)error;
39 |
40 | - (void)didSubscribeToStartReceivingNotificationsFor:(BDNotification *)service error:(NSError *)error;
41 | - (void)didUnsubscribeToStopRecivingNotificationsFor:(BDNotification *)service error:(NSError *)error;
42 | @end
43 |
44 | /****************************************************************************/
45 | /* Notification Service */
46 | /****************************************************************************/
47 | @interface BDNotification : BDObject
48 |
49 | @property (nonatomic, strong) BDNotificationAttributes *lastNotification;
50 |
51 | /****************************************************************************/
52 | /* Access to notificication listener instance */
53 | /****************************************************************************/
54 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
55 | delegate:(id)aController;
56 |
57 |
58 | #pragma mark -
59 | #pragma mark Writing to BLEduino
60 | // Write notifications to BLEduino.
61 | - (void) writeNotification:(BDNotificationAttributes *)notification withAck:(BOOL)enabled;
62 | - (void) writeNotification:(BDNotificationAttributes *)notification;
63 |
64 | #pragma mark -
65 | #pragma mark Reading from BLEduino
66 | // Read/Receiving notifications from BLEduino.
67 | - (void) readNotification;
68 | - (void) subscribeToStartReceivingNotifications;
69 | - (void) unsubscribeToStopReiceivingNotifications;
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDThrottleYawRollPitch.m:
--------------------------------------------------------------------------------
1 | //
2 | // Motion.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/4/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDThrottleYawRollPitch.h"
10 |
11 | @implementation BDThrottleYawRollPitch
12 |
13 |
14 | /*
15 | * Create Throttle-Yaw-Roll-Pitch.
16 | */
17 | + (instancetype)motion
18 | {
19 | return [[BDThrottleYawRollPitch alloc] init];
20 | }
21 |
22 | /*
23 | * Create Throttle-Yaw-Roll-Pitch characteristic from NSData object.
24 | */
25 | - (id) initWithData:(NSData *)motionData
26 | {
27 | self = [super init];
28 | if(self)
29 | {
30 | Byte *throttleByte = (Byte*)malloc(1);
31 | NSRange throttleRange = NSMakeRange(0, 1);
32 | [motionData getBytes:throttleByte range:throttleRange];
33 | NSData *throttleData = [[NSData alloc] initWithBytes:throttleByte length:1];
34 | _throttle = *(int*)([throttleData bytes]);
35 | free(throttleByte);
36 |
37 | Byte *yawByte = (Byte*)malloc(1);
38 | NSRange yawRange = NSMakeRange(1, 1);
39 | [motionData getBytes:yawByte range:yawRange];
40 | NSData *yawData = [[NSData alloc] initWithBytes:yawByte length:1];
41 | _yaw = *(int*)([yawData bytes]);
42 | free(yawByte);
43 |
44 |
45 | Byte *rollByte = (Byte*)malloc(1);
46 | NSRange rollRange = NSMakeRange(2, 1);
47 | [motionData getBytes:rollByte range:rollRange];
48 | NSData *rollData = [[NSData alloc] initWithBytes:rollByte length:1];
49 | _roll = *(int*)([rollData bytes]);
50 | free(rollByte);
51 |
52 |
53 | Byte *pitchByte = (Byte*)malloc(1);
54 | NSRange pitchRange = NSMakeRange(3, 1);
55 | [motionData getBytes:pitchByte range:pitchRange];
56 | NSData *pitchData = [[NSData alloc] initWithBytes:pitchByte length:1];
57 | _pitch = *(int*)([pitchData bytes]);
58 | free(pitchByte);
59 |
60 | }
61 | return self;
62 | }
63 |
64 | /*
65 | * Converts Throttle-Yaw-Roll-Pitch characteristic to an NSData object to send data to a peripheral.
66 | */
67 | - (NSData *)data
68 | {
69 | NSMutableData *motionData = [[NSMutableData alloc] initWithCapacity:4];
70 |
71 | Byte throttleByte = (self.throttle >> (0)) & 0xff;
72 | NSMutableData *throttleData = [NSMutableData dataWithBytes:&throttleByte length:sizeof(throttleByte)];
73 | [motionData appendData:throttleData];
74 |
75 | Byte yawByte = (self.yaw >> (0)) & 0xff;
76 | NSMutableData *yawData = [NSMutableData dataWithBytes:&yawByte length:sizeof(yawByte)];
77 | [motionData appendData:yawData];
78 |
79 | Byte rollByte = (self.roll >> (0)) & 0xff;
80 | NSMutableData *rollData = [NSMutableData dataWithBytes:&rollByte length:sizeof(rollByte)];
81 | [motionData appendData:rollData];
82 |
83 | Byte pitchByte = (self.pitch >> (0)) & 0xff;
84 | NSMutableData *pitchData = [NSMutableData dataWithBytes:&pitchByte length:sizeof(pitchByte)];
85 | [motionData appendData:pitchData];
86 |
87 | return motionData;
88 | }
89 |
90 | @end
91 |
--------------------------------------------------------------------------------
/Libraries/RESideMenu/RESideMenu.h:
--------------------------------------------------------------------------------
1 | //
2 | // REFrostedViewController.h
3 | // RESideMenu
4 | //
5 | // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import
27 | #import "UIViewController+RESideMenu.h"
28 |
29 | @protocol RESideMenuDelegate;
30 |
31 | @interface RESideMenu : UIViewController
32 |
33 | @property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
34 | @property (strong, readwrite, nonatomic) UIImage *backgroundImage;
35 | @property (assign, readwrite, nonatomic) BOOL panGestureEnabled;
36 | @property (assign, readwrite, nonatomic) BOOL scaleContentView;
37 | @property (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
38 | @property (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
39 | @property (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
40 | @property (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
41 | @property (strong, readwrite, nonatomic) id parallaxMenuMinimumRelativeValue;
42 | @property (strong, readwrite, nonatomic) id parallaxMenuMaximumRelativeValue;
43 | @property (strong, readwrite, nonatomic) id parallaxContentMinimumRelativeValue;
44 | @property (strong, readwrite, nonatomic) id parallaxContentMaximumRelativeValue;
45 | @property (assign, readwrite, nonatomic) BOOL parallaxEnabled;
46 |
47 | @property (strong, readwrite, nonatomic) UIViewController *contentViewController;
48 | @property (strong, readwrite, nonatomic) UIViewController *menuViewController;
49 |
50 | @property (weak, readwrite, nonatomic) id delegate;
51 |
52 | - (id)initWithContentViewController:(UIViewController *)contentViewController menuViewController:(UIViewController *)menuViewController;
53 | - (void)presentMenuViewController;
54 | - (void)hideMenuViewController;
55 |
56 | @end
57 |
58 | @protocol RESideMenuDelegate
59 |
60 | @optional
61 | - (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;
62 | - (void)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController;
63 | - (void)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController;
64 | - (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
65 | - (void)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController;
66 |
67 | @end
--------------------------------------------------------------------------------
/BLEduino-Libray/BleduinoController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BLEduinoTableViewController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/15/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BleduinoController.h"
10 | #import "BDBleduino.h"
11 |
12 | @interface BleduinoController ()
13 |
14 | @end
15 |
16 | @implementation BleduinoController
17 |
18 | - (id)initWithStyle:(UITableViewStyle)style
19 | {
20 | self = [super initWithStyle:style];
21 | if (self) {
22 | // Custom initialization
23 | }
24 | return self;
25 | }
26 |
27 | - (void)viewDidLoad
28 | {
29 | [super viewDidLoad];
30 |
31 | [self.bleduinoName setDelegate:self];
32 | [self.bleduinoName becomeFirstResponder];
33 | [self.bleduinoName setPlaceholder:self.bleduino.name];
34 |
35 | CGRect header = CGRectMake(0, 0, 300, 100);
36 | UIView *headerView = [[UIView alloc] initWithFrame:header];
37 | self.tableView.tableHeaderView = headerView;
38 | }
39 |
40 | - (void)didReceiveMemoryWarning
41 | {
42 | [super didReceiveMemoryWarning];
43 | // Dispose of any resources that can be recreated.
44 | }
45 |
46 | - (BOOL)textFieldShouldReturn:(UITextField *)textField
47 | {
48 | if(self.bleduinoName.text.length <= 18)
49 | {
50 | NSString *trimmedName = [self.bleduinoName.text stringByTrimmingCharactersInSet:
51 | [NSCharacterSet whitespaceCharacterSet]];
52 |
53 | if(trimmedName.length > 0)
54 | {
55 | [BDBleduino updateBleduinoName:self.bleduino name:trimmedName];
56 | }
57 |
58 | [self.delegate didUpateBleduino:self.bleduino controller:self];
59 | }
60 | else
61 | {
62 | NSString *message = @"The device name must be 18 characters or less.";
63 | UIAlertView *notificationAlert = [[UIAlertView alloc]initWithTitle:@"Name is too long"
64 | message:message
65 | delegate:nil
66 | cancelButtonTitle:@"Ok"
67 | otherButtonTitles:nil];
68 |
69 | [notificationAlert show];
70 | }
71 |
72 | return NO;
73 | }
74 |
75 | - (IBAction)dismissModule:(id)sender
76 | {
77 | [self.delegate didDismissBleduinoController:self];
78 | }
79 |
80 | - (IBAction)updateBleduinoName:(id)sender
81 | {
82 | if(self.bleduinoName.text.length <= 18)
83 | {
84 | NSString *trimmedString = [self.bleduinoName.text stringByTrimmingCharactersInSet:
85 | [NSCharacterSet whitespaceCharacterSet]];
86 |
87 | if(trimmedString.length > 0)
88 | {
89 | [BDBleduino updateBleduinoName:self.bleduino name:trimmedString];
90 | }
91 |
92 | [self.delegate didUpateBleduino:self.bleduino controller:self];
93 | }
94 | else
95 | {
96 | NSString *message = @"The device name must be 18 characters or less.";
97 | UIAlertView *notificationAlert = [[UIAlertView alloc]initWithTitle:@"Name is too long"
98 | message:message
99 | delegate:nil
100 | cancelButtonTitle:@"Ok"
101 | otherButtonTitles:nil];
102 |
103 | [notificationAlert show];
104 | }
105 | }
106 |
107 | @end
108 |
--------------------------------------------------------------------------------
/BLEduino/BLEduino-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundlePrimaryIcon
14 |
15 | CFBundleIconFiles
16 |
17 | appicon58
18 | appicon80
19 | appicon120
20 |
21 |
22 |
23 | CFBundleIdentifier
24 | com.kytelabs.${PRODUCT_NAME:rfc1034identifier}
25 | CFBundleInfoDictionaryVersion
26 | 6.0
27 | CFBundleName
28 | ${PRODUCT_NAME}
29 | CFBundlePackageType
30 | APPL
31 | CFBundleShortVersionString
32 | 1.0
33 | CFBundleSignature
34 | ????
35 | CFBundleVersion
36 | 1.0
37 | LSRequiresIPhoneOS
38 |
39 | UIBackgroundModes
40 |
41 | bluetooth-central
42 | bluetooth-peripheral
43 |
44 | UILaunchImages
45 |
46 |
47 | UILaunchImageMinimumOSVersion
48 | 7.0
49 | UILaunchImageName
50 | launch1136
51 | UILaunchImageOrientation
52 | Portrait
53 | UILaunchImageSize
54 | {320, 568}
55 |
56 |
57 | UILaunchImageMinimumOSVersion
58 | 7.0
59 | UILaunchImageName
60 | launch960
61 | UILaunchImageOrientation
62 | Portrait
63 | UILaunchImageSize
64 | {320, 480}
65 |
66 |
67 | UILaunchImageMinimumOSVersion
68 | 7.0
69 | UILaunchImageName
70 | launch-small
71 | UILaunchImageOrientation
72 | Portrait
73 | UILaunchImageSize
74 | {320, 480}
75 |
76 |
77 | UILaunchImageMinimumOSVersion
78 | 7.0
79 | UILaunchImageName
80 | launch
81 | UILaunchImageOrientation
82 | Portrait
83 | UILaunchImageSize
84 | {320, 480}
85 |
86 |
87 | UILaunchImageMinimumOSVersion
88 | 7.0
89 | UILaunchImageName
90 | launch
91 | UILaunchImageOrientation
92 | Portrait
93 | UILaunchImageSize
94 | {320, 568}
95 |
96 |
97 | UIMainStoryboardFile
98 | Main
99 | UIRequiredDeviceCapabilities
100 |
101 | bluetooth-le
102 | armv7
103 |
104 | UIStatusBarHidden
105 |
106 | UISupportedInterfaceOrientations
107 |
108 | UIInterfaceOrientationPortrait
109 | UIInterfaceOrientationLandscapeLeft
110 | UIInterfaceOrientationLandscapeRight
111 |
112 | UIViewControllerBasedStatusBarAppearance
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDUart.h:
--------------------------------------------------------------------------------
1 | //
2 | // UARTServiceClass.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 9/24/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BDObject.h"
12 |
13 | #pragma mark -
14 | #pragma mark UART Service UUIDs
15 | /****************************************************************************/
16 | /* Service & Characteristics */
17 | /****************************************************************************/
18 | extern NSString * const kUARTServiceUUIDString; //8C6BDA7A-A312-681D-025B-0032C0D16A2D UART Service
19 | extern NSString * const kRxCharacteristicUUIDString; //8C6BABCD-A312-681D-025B-0032C0D16A2D Read(Rx) Message Characteristic
20 | extern NSString * const kTxCharacteristicUUIDString; //8C6B1010-A312-681D-025B-0032C0D16A2D Write(Tx) Message Characteristic
21 |
22 |
23 | /****************************************************************************/
24 | /* Rx/Tx Transmission State */
25 | /****************************************************************************/
26 | enum {
27 | RxTxTransmissionStateStarted = 0,
28 | RxTxTransmissionStateInTransit = 1,
29 | RxTxTransmissionStateEnded = 2,
30 | };
31 | typedef NSUInteger RxTxTransmissionState;
32 |
33 |
34 | #pragma mark -
35 | #pragma mark UART Service Protocol
36 | /****************************************************************************/
37 | /* Protocol */
38 | /****************************************************************************/
39 | @class BDUart;
40 | @protocol UARTServiceDelegate
41 | @optional
42 | - (void)uartService:(BDUart *)service didReceiveData:(NSData *)data error:(NSError *)error;
43 | - (void)uartService:(BDUart *)service didReceiveMessage:(NSString *)message error:(NSError *)error;
44 |
45 | - (void)uartService:(BDUart *)service didWriteData:(NSData *)data error:(NSError *)error;
46 | - (void)uartService:(BDUart *)service didWriteMessage:(NSString *)message error:(NSError *)error;
47 |
48 | - (void)didSubscribeToReceiveDataFor:(BDUart *)service error:(NSError *)error;
49 | - (void)didUnsubscribeToReceiveDataFor:(BDUart *)service error:(NSError *)error;
50 |
51 | - (void)didSubscribeToReceiveMessagesFor:(BDUart *)service error:(NSError *)error;
52 | - (void)didUnsubscribeToReceiveMessagesFor:(BDUart *)service error:(NSError *)error;
53 | @end
54 |
55 |
56 | /****************************************************************************/
57 | /* UART Service */
58 | /****************************************************************************/
59 | @interface BDUart : BDObject
60 |
61 | @property (strong) NSString *messageSent;
62 | @property (strong) NSString *messageReceived;
63 |
64 | @property (strong) NSData *dataSent;
65 | @property (strong) NSData *dataReceived;
66 |
67 | - (id) initWithPeripheral:(CBPeripheral *)aPeripheral
68 | delegate:(id)aController;
69 |
70 | #pragma mark -
71 | #pragma mark Writing to BLEduino
72 | // Writing messages to BLEduino.
73 | - (void) writeMessage:(NSString *)message withAck:(BOOL)enabled;
74 | - (void) writeMessage:(NSString *)message;
75 |
76 | // Writing data to BLEduino.
77 | - (void) writeData:(NSData *)data withAck:(BOOL)enabled;
78 | - (void) writeData:(NSData *)data;
79 |
80 | #pragma mark -
81 | #pragma mark Reading from BLEduino
82 | // Read/Receiving messages from BLEduino.
83 | - (void) readMessage;
84 | - (void) subscribeToStartReceivingMessages;
85 | - (void) unsubscribeToStopReiceivingMessages;
86 |
87 | // Read/Receiving data from BLEduino.
88 | - (void) readData;
89 | - (void) subscribeToStartReceivingData;
90 | - (void) unsubscribeToStopReiceivingData;
91 |
92 | @end
93 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/valerieann.xcuserdatad/xcschemes/BLEduino.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/ramongonzalez.xcuserdatad/xcschemes/BLEduino.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // BleService.h
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/17/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | /****************************************************************************/
13 | /* BLEduino Service */
14 | /****************************************************************************/
15 | extern NSString * const kBLEduinoServiceUUIDString; //8C6B2013-A312-681D-025B-0032C0D16A2D"
16 |
17 | @interface BDObject : NSObject
18 | {
19 | @protected CBPeripheral *_servicePeripheral;
20 | }
21 |
22 | @property (readonly, strong) CBPeripheral *peripheral;
23 |
24 | /*
25 | * Destroy reference to peripheral device.
26 | */
27 | - (void) dismissPeripheral;
28 |
29 |
30 | /*
31 | * @method writeCharacteristic:serviceUUID:characteristicUUID:data:
32 | *
33 | * @discussion This method writes and verifies that a specific characteristic/service
34 | * is supported by the peripheral before writing.
35 | *
36 | * @param sUUID UUID for Service to write.
37 | * @param cUUID UUID for Characteristic to write.
38 | * @param data The value to write.
39 | *
40 | */
41 | -(void)writeDataToServiceUUID:(CBUUID *)sUUID
42 | characteristicUUID:(CBUUID *)cUUID
43 | data:(NSData *)data
44 | withAck:(BOOL)enabled;
45 |
46 | /*
47 | * @method readCharacteristic:serviceUUID:characteristicUUID:
48 | *
49 | * @discussion This method reads and verifies that a specific characteristic/service
50 | * is supported by the peripheral before requesting value.
51 | *
52 | * @param sUUID UUID for Service to write.
53 | * @param cUUID UUID for Characteristic to write.
54 | *
55 | */
56 | -(void)readDataFromServiceUUID:(CBUUID *)sUUID
57 | characteristicUUID:(CBUUID *)cUUID;
58 |
59 | /*
60 | * @method setNotificationForCharacteristic:serviceUUID:characteristicUUID:notifyValue:
61 | *
62 | * @discussion This method requests subscription for notifications and verifies that
63 | * a specific characteristic/service is supported by the peripheral before
64 | * requesting subscription.
65 | *
66 | * @param sUUID UUID for Service to write.
67 | * @param cUUID UUID for Characteristic to write.
68 | * @param data The value to write.
69 | *
70 | */
71 | -(void)setNotificationForServiceUUID:(CBUUID *)sUUID
72 | characteristicUUID:(CBUUID *)cUUID
73 | notifyValue:(BOOL)value;
74 |
75 |
76 | /*
77 | * @method peripheral:didUpdateValueForCharacteristic:
78 | *
79 | * @discussion CBPeripherals can have but one delegate (even after copying them). Thus,
80 | * this method serves as a gateway to forward updates/acks been sent from BLEduinos
81 | * to all services listening for updates/acks.
82 | *
83 | * @param bleduino Peripheral sending the update.
84 | * @param characteristic The characteristic whose value was updated.
85 | * @param error Error message if any.
86 | */
87 | + (void)peripheral:(CBPeripheral *)bleduino didWriteValueForCharacteristic:(CBCharacteristic *)characteristic
88 | error:(NSError *)error;
89 |
90 |
91 | + (void)peripheral:(CBPeripheral *)bleduino didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic
92 | error:(NSError *)error;
93 |
94 |
95 | + (void)peripheral:(CBPeripheral *)bleduino didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic
96 | error:(NSError *)error;
97 |
98 |
99 | + (instancetype)initializeWithBleduino:(CBPeripheral *)bleduino;
100 | @end
101 |
--------------------------------------------------------------------------------
/BLEduino/VerticalJoystickControlView.m:
--------------------------------------------------------------------------------
1 | //
2 | // VerticalJoystickControlView.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/19/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "VerticalJoystickControlView.h"
10 |
11 | @interface VerticalJoystickControlView ()
12 | @property (strong) UIImage *joystickNeutralImage;
13 | @property (strong) UIImage *joystickHoldImage;
14 | @property CGPoint offset;
15 |
16 | @property (weak) IBOutlet UIImageView *joystickView;
17 | @end
18 |
19 | @implementation VerticalJoystickControlView
20 |
21 | - (void) initJoystick
22 | {
23 | self.joystickNeutralImage = [UIImage imageNamed:@"joystick-neutral.png"];
24 | self.joystickHoldImage = [UIImage imageNamed:@"joystick-hold.png"];
25 |
26 | CGRect centerFrame = CGRectMake(90, 90, 90, 90); //Center position.
27 | CGPoint center = CGPointMake(CGRectGetMidX(centerFrame), CGRectGetMidY(centerFrame));
28 | self.lastPosition = center;
29 | }
30 |
31 | - (id)initWithFrame:(CGRect)frame
32 | {
33 | self = [super initWithFrame:frame];
34 | if (self) {
35 | // Initialization code
36 | [self initJoystick];
37 | }
38 | return self;
39 | }
40 |
41 | - (id)initWithCoder:(NSCoder *)coder
42 | {
43 | self = [super initWithCoder:coder];
44 | if (self)
45 | {
46 | // Initialization code
47 | [self initJoystick];
48 | }
49 | return self;
50 | }
51 |
52 |
53 | #pragma mark -
54 | #pragma mark Joystick Movement Methods
55 | /****************************************************************************/
56 | /* Joystick Control Movement */
57 | /****************************************************************************/
58 |
59 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
60 | {
61 | //Update joystick image to hold state image.
62 | self.joystickView.image = self.joystickHoldImage;
63 |
64 | UITouch *aTouch = [touches anyObject];
65 | self.offset = [aTouch locationInView:self.joystickView];
66 | }
67 |
68 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
69 | {
70 | UITouch *aTouch = [touches anyObject];
71 | UIView *view = [aTouch view];
72 |
73 | CGPoint location = [aTouch locationInView:view];
74 | CGPoint destination = CGPointMake(location.x - _offset.x, location.y - _offset.y);
75 |
76 | CGRect newFrame = CGRectMake(destination.x, destination.y, 90, 90);
77 | CGPoint center = CGPointMake(CGRectGetMidX(newFrame), CGRectGetMidY(newFrame));
78 |
79 | double differenceY = fabsf(center.y - 135);
80 | double maxDistance = sqrt(differenceY * differenceY);
81 |
82 | if(maxDistance < 90)
83 | {
84 | //Send throttle data.
85 | //Lowering resolution to 30. If change is 6px then send data update.
86 | if(labs(self.lastPosition.y - center.y) > 5)
87 | {
88 | self.lastPosition = center;
89 | CGPoint adaptedPoint = CGPointMake(0, (center.y-45)/6);
90 | [self.delegate verticalJoystickDidUpdate:adaptedPoint];
91 | }
92 |
93 | //Execute movement.
94 | [UIView beginAnimations:@"Moving Joystick" context:nil];
95 | self.joystickView.frame = CGRectMake(self.joystickView.frame.origin.x, destination.y, 90, 90);
96 | [UIView commitAnimations];
97 | }
98 | }
99 |
100 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
101 | {
102 | CGRect centerFrame = CGRectMake(90, 90, 90, 90); //Center position.
103 | CGPoint center = CGPointMake(0, 15); //Center position.
104 | self.lastPosition = center;
105 |
106 | //Send throttle data.
107 | [self.delegate verticalJoystickDidUpdate:center];
108 |
109 | [UIView beginAnimations:@"Moving Joystick" context:nil];
110 | self.joystickView.frame = centerFrame;
111 | [UIView setAnimationDuration:0.1];
112 | [UIView commitAnimations];
113 |
114 | //Update joystick image to neutral state image.
115 | self.joystickView.image = self.joystickNeutralImage;
116 | }
117 | @end
118 |
--------------------------------------------------------------------------------
/Libraries/UIImage+ColorAtPixel/UIImage+ColorAtPixel.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009 Ole Begemann
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | /*
24 | UIImage+ColorAtPixel.m
25 |
26 | Created by Ole Begemann
27 | October, 2009
28 | */
29 |
30 | #import
31 | #import "UIImage+ColorAtPixel.h"
32 |
33 | @implementation UIImage (ColorAtPixel)
34 |
35 | /*
36 | Returns the color of the image pixel at point. Returns nil if point lies outside the image bounds.
37 | If the point coordinates contain decimal parts, they will be truncated.
38 |
39 | To get at the pixel data, this method must draw the image into a bitmap context.
40 | For minimal memory usage and optimum performance, only the specific requested
41 | pixel is drawn.
42 | If you need to query pixel colors for the same image repeatedly (e.g., in a loop),
43 | this approach is probably less efficient than drawing the entire image into memory
44 | once and caching it.
45 | */
46 | - (UIColor *)colorAtPixel:(CGPoint)point
47 | {
48 | // Cancel if point is outside image coordinates
49 | if (!CGRectContainsPoint(CGRectMake(0.0f, 0.0f, self.size.width, self.size.height), point)) {
50 | return nil;
51 | }
52 |
53 | // Create a 1x1 pixel byte array and bitmap context to draw the pixel into.
54 | // Reference: http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage
55 | NSInteger pointX = trunc(point.x);
56 | NSInteger pointY = trunc(point.y);
57 | CGImageRef cgImage = self.CGImage;
58 | NSUInteger width = self.size.width;
59 | NSUInteger height = self.size.height;
60 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
61 | int bytesPerPixel = 4;
62 | int bytesPerRow = bytesPerPixel * 1;
63 | NSUInteger bitsPerComponent = 8;
64 | unsigned char pixelData[4] = { 0, 0, 0, 0 };
65 | CGContextRef context = CGBitmapContextCreate(pixelData,
66 | 1,
67 | 1,
68 | bitsPerComponent,
69 | bytesPerRow,
70 | colorSpace,
71 | kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
72 | CGColorSpaceRelease(colorSpace);
73 | CGContextSetBlendMode(context, kCGBlendModeCopy);
74 |
75 | // Draw the pixel we are interested in onto the bitmap context
76 | CGContextTranslateCTM(context, -pointX, pointY-(CGFloat)height);
77 | CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, (CGFloat)width, (CGFloat)height), cgImage);
78 | CGContextRelease(context);
79 |
80 | // Convert color values [0..255] to floats [0.0..1.0]
81 | CGFloat red = (CGFloat)pixelData[0] / 255.0f;
82 | CGFloat green = (CGFloat)pixelData[1] / 255.0f;
83 | CGFloat blue = (CGFloat)pixelData[2] / 255.0f;
84 | CGFloat alpha = (CGFloat)pixelData[3] / 255.0f;
85 | return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
86 | }
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/BLEduino/HorizontalJoystickControlView.m:
--------------------------------------------------------------------------------
1 | //
2 | // HorizontalJoystickControlView.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/19/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "HorizontalJoystickControlView.h"
10 |
11 | @interface HorizontalJoystickControlView ()
12 | @property (strong) UIImage *joystickNeutralImage;
13 | @property (strong) UIImage *joystickHoldImage;
14 | @property CGPoint offset;
15 |
16 | @property (weak) IBOutlet UIImageView *joystickView;
17 | @end
18 |
19 | @implementation HorizontalJoystickControlView
20 |
21 | - (void) initJoystick
22 | {
23 | self.joystickNeutralImage = [UIImage imageNamed:@"joystick-neutral.png"];
24 | self.joystickHoldImage = [UIImage imageNamed:@"joystick-hold.png"];
25 |
26 | CGRect centerFrame = CGRectMake(90, 90, 90, 90); //Center position.
27 | CGPoint center = CGPointMake(CGRectGetMidX(centerFrame), CGRectGetMidY(centerFrame));
28 | self.lastPosition = center;
29 | }
30 |
31 | - (id)initWithFrame:(CGRect)frame
32 | {
33 | self = [super initWithFrame:frame];
34 | if (self) {
35 | // Initialization code
36 | [self initJoystick];
37 | }
38 | return self;
39 | }
40 |
41 | - (id)initWithCoder:(NSCoder *)coder
42 | {
43 | self = [super initWithCoder:coder];
44 | if (self)
45 | {
46 | // Initialization code
47 | [self initJoystick];
48 | }
49 | return self;
50 | }
51 |
52 |
53 | #pragma mark -
54 | #pragma mark Joystick Movement Methods
55 | /****************************************************************************/
56 | /* Joystick Control Movement */
57 | /****************************************************************************/
58 |
59 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
60 | {
61 | //Update joystick image to hold state image.
62 | self.joystickView.image = self.joystickHoldImage;
63 |
64 | UITouch *aTouch = [touches anyObject];
65 | self.offset = [aTouch locationInView:self.joystickView];
66 | }
67 |
68 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
69 | {
70 | UITouch *aTouch = [touches anyObject];
71 | UIView *view = [aTouch view];
72 |
73 | CGPoint location = [aTouch locationInView:view];
74 | CGPoint destination = CGPointMake(location.x - _offset.x, location.y - _offset.y);
75 |
76 | CGRect newFrame = CGRectMake(destination.x, destination.y, 90, 90);
77 | CGPoint center = CGPointMake(CGRectGetMidX(newFrame), CGRectGetMidY(newFrame));
78 |
79 | double differenceX = fabsf(center.x - 135);
80 | double maxDistance = sqrt(differenceX * differenceX);
81 |
82 | //Joystick is within allowed space? Update location.
83 | if(maxDistance < 90)
84 | {
85 | //Send yaw data.
86 | //Lowering resolution to 30. If change is 6px then send data update.
87 | if(labs(self.lastPosition.x - center.x) > 5)
88 | {
89 | self.lastPosition = center;
90 | CGPoint adaptedPoint = CGPointMake((center.x-45)/6, 0);
91 | [self.delegate horizontalJoystickDidUpdate:adaptedPoint];
92 | }
93 |
94 | //Execute movement.
95 | [UIView beginAnimations:@"Moving Joystick" context:nil];
96 | self.joystickView.frame = CGRectMake(destination.x, self.joystickView.frame.origin.y, 90, 90);
97 | [UIView commitAnimations];
98 | }
99 | }
100 |
101 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
102 | {
103 | CGRect centerFrame = CGRectMake(90, 90, 90, 90); //Center position.
104 | CGPoint center = CGPointMake(15, 0); //Center position.
105 | self.lastPosition = center;
106 |
107 | //Send throttle data.
108 | [self.delegate horizontalJoystickDidUpdate:center];
109 |
110 | [UIView beginAnimations:@"Moving Joystick" context:nil];
111 | self.joystickView.frame = centerFrame;
112 | [UIView setAnimationDuration:0.1];
113 | [UIView commitAnimations];
114 |
115 | //Update joystick image to neutral state image.
116 | self.joystickView.image = self.joystickNeutralImage;
117 | }
118 |
119 | @end
120 |
--------------------------------------------------------------------------------
/BLEduino-Libray/BDFirmataCommand.m:
--------------------------------------------------------------------------------
1 | //
2 | // FirmataCommandCharacteristic.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/6/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "BDFirmataCommand.h"
10 |
11 | @implementation BDFirmataCommand
12 |
13 | /*
14 | * Create Firmata Command.
15 | */
16 | + (instancetype)command
17 | {
18 | return [[BDFirmataCommand alloc] init];
19 | }
20 |
21 | /*
22 | * Create Firmata Command.
23 | */
24 | - (id) initWithPinState:(FirmataCommandPinState)state
25 | pinNumber:(NSInteger)number
26 | pinValue:(NSInteger)value
27 | {
28 | self = [super init];
29 | if(self)
30 | {
31 | self.pinState = state;
32 | self.pinNumber = number;
33 | self.pinValue = value;
34 | }
35 |
36 | return self;
37 | }
38 |
39 | /*
40 | * Create Firmata Command.
41 | */
42 | + (id) commandPinState:(FirmataCommandPinState)state
43 | pinNumber:(NSInteger)number
44 | pinValue:(NSInteger)value
45 | {
46 | BDFirmataCommand *command =
47 | [[BDFirmataCommand alloc] initWithPinState:state
48 | pinNumber:number
49 | pinValue:value];
50 |
51 | return command;
52 | }
53 |
54 | /*
55 | * Create Firmata Command characteristic from NSData object.
56 | */
57 | - (id) initWithData:(NSData *)firmataCommandData
58 | {
59 | self = [super init];
60 | if(self)
61 | {
62 | //Converting pinNumber byte to integer.
63 | Byte *pinNumberByte = (Byte*)malloc(1);
64 | NSRange pinNumberRange = NSMakeRange(0, 1);
65 | [firmataCommandData getBytes:pinNumberByte range:pinNumberRange];
66 | NSData *pinNumberData = [[NSData alloc] initWithBytes:pinNumberByte length:1];
67 | self.pinNumber = *(int*)([pinNumberData bytes]);
68 | free(pinNumberByte);
69 |
70 | //Converting pinState byte to corresponding FirmataCommandPinState.
71 | Byte *pinStateByte = (Byte*)malloc(1);
72 | NSRange pinStateRange = NSMakeRange(1, 1);
73 | [firmataCommandData getBytes:pinStateByte range:pinStateRange];
74 | NSData *pinStateData = [[NSData alloc] initWithBytes:pinStateByte length:1];
75 | self.pinState = *(int*)([pinStateData bytes]);
76 | free(pinStateByte);
77 |
78 | //Converting pinValue byte to integer.
79 | Byte *pinValueByte = (Byte*)malloc(1);
80 | NSRange pinValueRange = NSMakeRange(2, 1);
81 | [firmataCommandData getBytes:pinValueByte range:pinValueRange];
82 | NSData *pinValueData = [[NSData alloc] initWithBytes:pinValueByte length:1];
83 | NSInteger msb = *(int*)([pinValueData bytes]);
84 | free(pinValueByte);
85 |
86 | Byte *pinValueByteLSB = (Byte*)malloc(1);
87 | NSRange pinValueRangeLSB = NSMakeRange(3, 1);
88 | [firmataCommandData getBytes:pinValueByteLSB range:pinValueRangeLSB];
89 | NSData *pinValueDataLSB = [[NSData alloc] initWithBytes:pinValueByteLSB length:1];
90 | NSInteger lsb = *(int*)([pinValueDataLSB bytes]);
91 | free(pinValueByteLSB);
92 |
93 | //Shift MSB and OR it with LSB to get final value.
94 | NSInteger msb_shifted = msb << 8;
95 | self.pinValue = (lsb | msb_shifted);
96 | }
97 | return self;
98 | }
99 |
100 | /*
101 | * Converts Firmata Command characteristic to an NSData object to send data to a peripheral.
102 | */
103 | - (NSData *)data
104 | {
105 | NSMutableData *firmataCommandData = [[NSMutableData alloc] initWithCapacity:3];
106 |
107 | Byte pinNumberByte = (self.pinNumber >> (0)) & 0xff;
108 | NSMutableData *pinNumberData = [NSMutableData dataWithBytes:&pinNumberByte length:sizeof(pinNumberByte)];
109 | [firmataCommandData appendData:pinNumberData];
110 |
111 | Byte pinStateByte = (self.pinState >> (0)) & 0xff;
112 | NSMutableData *pinStateData = [NSMutableData dataWithBytes:&pinStateByte length:sizeof(pinStateByte)];
113 | [firmataCommandData appendData:pinStateData];
114 |
115 | Byte pinValueByte = (self.pinValue >> (0)) & 0xff;
116 | NSMutableData *pinValueData = [NSMutableData dataWithBytes:&pinValueByte length:sizeof(pinValueByte)];
117 | [firmataCommandData appendData:pinValueData];
118 |
119 |
120 | return firmataCommandData;
121 | }
122 |
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/BLEduino/PowerRelayViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // PowerRelayViewController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "PowerRelayViewController.h"
10 | #import "BDLeManager.h"
11 | #import "PowerNextStateView.h"
12 | #import "BDBleduino.h"
13 |
14 | @interface PowerRelayViewController ()
15 | @property (strong) BDFirmataCommand *lastPowerSwitchCommand;
16 | @property (weak) IBOutlet PowerSwitchButtonView *powerSwitch;
17 | @property (weak) IBOutlet PowerNextStateView *otherStateIsOn;
18 | @property (weak) IBOutlet PowerNextStateView *otherStateIsOff;
19 | @property NSInteger pinNumber;
20 | @end
21 |
22 | @implementation PowerRelayViewController
23 |
24 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
25 | {
26 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
27 | if (self) {
28 | // Custom initialization
29 | }
30 | return self;
31 | }
32 |
33 | - (void)viewDidLoad
34 | {
35 | [super viewDidLoad];
36 |
37 | self.powerSwitch.delegate = self;
38 | self.otherStateIsOff.delegate = self;
39 | self.otherStateIsOn.delegate = self;
40 |
41 | //Update module based on settings.
42 | self.pinNumber = [[NSUserDefaults standardUserDefaults] integerForKey:SETTINGS_POWERRELAY_PIN_NUMBER];
43 |
44 | //Set appareance.
45 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
46 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
47 | green:THEME_COLOR_GREEN/255.0
48 | blue:THEME_COLOR_BLUE/255.0
49 | alpha:1.0];
50 |
51 | [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
52 | self.navigationController.navigationBar.barTintColor = lightBlue;
53 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
54 | self.navigationController.navigationBar.translucent = NO;
55 |
56 | [[UIScreen mainScreen] applicationFrame];
57 | }
58 |
59 | - (void)didReceiveMemoryWarning
60 | {
61 | [super didReceiveMemoryWarning];
62 | // Dispose of any resources that can be recreated.
63 | }
64 |
65 | - (void)dismissModule
66 | {
67 | [self.delegate powerRelayModulViewControllerDismissed:self];
68 | }
69 |
70 | - (void)startPowerRelaySwitchViewWithStateOn:(BOOL)state
71 | {
72 | CGRect newFrame;
73 | //Switch it On?
74 | if(state)
75 | {
76 | //Move it to top half position.
77 | newFrame = CGRectMake(10, 10, 300, 245);
78 | }
79 | else
80 | {
81 | //Move it to bottom half position.
82 | newFrame = CGRectMake(10, 250, 300, 245);
83 | }
84 |
85 | self.powerSwitch.frame = newFrame;
86 | self.isLastPowerRelayStateON = state;
87 | }
88 |
89 | - (void)updatePowerSwitchViewWithStateOn:(BOOL)state
90 | {
91 | CGRect newFrame;
92 | //Switch it On?
93 | if(state)
94 | {
95 | //Move it to top half position.
96 | newFrame = CGRectMake(10, 10, 300, 245);
97 | }
98 | else
99 | {
100 | //Move it to bottom half position.
101 | newFrame = CGRectMake(10, 250, 300, 245);
102 | }
103 |
104 | //Execute view update.
105 | [UIView beginAnimations:@"Dragging Power Switch" context:nil];
106 | self.powerSwitch.frame = newFrame;
107 | [self.powerSwitch updatePowerSwitchTextWithStateOn:state];
108 | [UIView setAnimationDuration:0.3];
109 | [UIView commitAnimations];
110 | }
111 |
112 | //Power Switch Delegate
113 | - (void)powerSwitchDidUpdateWithStateOn:(BOOL)state
114 | {
115 | //If the state remains the same do not re-send the data.
116 | if(self.isLastPowerRelayStateON == state)return;
117 | self.isLastPowerRelayStateON = state;
118 |
119 | //Create firmata command.
120 | BDFirmataCommand *switchUpdate = [BDFirmataCommand command];
121 | switchUpdate.pinState = FirmataCommandPinStateOutput;
122 | switchUpdate.pinValue = (state)?255:0; //255 > High, 0 > Low
123 | switchUpdate.pinNumber = _pinNumber;
124 | _lastPowerSwitchCommand = switchUpdate;
125 |
126 | //Send command.
127 | [BDBleduino writeValue:switchUpdate];
128 |
129 | NSLog(@"Sent PowerRelay update, PinValue: %ld, PinNumber: %ld, PinState: %ld",
130 | (long)_lastPowerSwitchCommand.pinValue,
131 | (long)_lastPowerSwitchCommand.pinNumber,
132 | (long)_lastPowerSwitchCommand.pinState);
133 | }
134 |
135 | //Power Other State Delegate
136 | - (void)powerOtherStateDidUpdateWithStateOn:(BOOL)state
137 | {
138 | //User tocuhed the other state label instead of dragging the switch.
139 | //Update switch view i.e. move it, and then send firmata command.
140 | [self updatePowerSwitchViewWithStateOn:state];
141 | [self powerSwitchDidUpdateWithStateOn:state];
142 | }
143 |
144 | @end
145 |
--------------------------------------------------------------------------------
/BLEduino/RSSIAlertController.m:
--------------------------------------------------------------------------------
1 | //
2 | // RSSIDistanceAlertController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/9/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "RSSIAlertController.h"
10 |
11 | @interface RSSIAlertController ()
12 |
13 | @end
14 |
15 | @implementation RSSIAlertController
16 |
17 | - (id)initWithStyle:(UITableViewStyle)style
18 | {
19 | self = [super initWithStyle:style];
20 | if (self) {
21 | // Custom initialization
22 | }
23 | return self;
24 | }
25 |
26 | - (void)viewDidLoad
27 | {
28 | [super viewDidLoad];
29 |
30 | //Set appareance.
31 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
32 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
33 | green:THEME_COLOR_GREEN/255.0
34 | blue:THEME_COLOR_BLUE/255.0
35 | alpha:1.0];
36 |
37 | [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
38 | self.navigationController.navigationBar.barTintColor = lightBlue;
39 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
40 | self.navigationController.navigationBar.translucent = NO;
41 |
42 | self.rssiSlider.tintColor = lightBlue;
43 |
44 | //Set message delegate
45 | self.message.delegate = self;
46 |
47 | //Setup slider update method.
48 | self.rssiSlider.value = -75;
49 | self.rssiSlider.continuous = YES;
50 | [self.rssiSlider addTarget:self
51 | action:@selector(updateRSSIIndicator:)
52 | forControlEvents:UIControlEventValueChanged];
53 |
54 | //If it is an update
55 | if(!self.isNewAlert)
56 | {
57 | //Populate with data of alert to be updated.
58 | self.message.text = self.alert.message;
59 | self.rssiSlider.value = self.alert.distance;
60 | }
61 |
62 | NSInteger currentDistanceValue = self.rssiSlider.value;
63 | self.rssiIndicator.text = [NSString stringWithFormat:@"%ld dBm", (long)currentDistanceValue];
64 |
65 | //First alert?
66 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
67 | BOOL isFirstAlert = [defaults boolForKey:PROXIMITY_FIRST_ALERT];
68 | if(isFirstAlert)
69 | {
70 | NSString *message = @"Proximity alerts are only supported on the foreground. That is, you must have the application open for them to work.";
71 | UIAlertView *firstAlert = [[UIAlertView alloc]initWithTitle:@"Proximity Alerts"
72 | message:message
73 | delegate:nil
74 | cancelButtonTitle:@"Ok"
75 | otherButtonTitles:nil];
76 | [firstAlert show];
77 | }
78 | }
79 |
80 | - (void)didReceiveMemoryWarning
81 | {
82 | [super didReceiveMemoryWarning];
83 | // Dispose of any resources that can be recreated.
84 | }
85 |
86 | - (IBAction)dismissModule:(id)sender
87 | {
88 | [self.delegate rssiAlertControllerDismissed:self];
89 | }
90 |
91 | - (BOOL)textFieldShouldReturn:(UITextField *)textField
92 | {
93 | [self.message resignFirstResponder];
94 | return NO;
95 | }
96 |
97 | - (IBAction)updateRSSIAlert:(id)sender
98 | {
99 | if(self.message.text.length > 0)
100 | {
101 | if(self.isNewAlert)
102 | {
103 | self.alert = [[ProximityAlert alloc] init];
104 | self.alert.message = self.message.text;
105 | self.alert.distance = self.rssiSlider.value;
106 | self.alert.isDistanceAlert = NO;
107 |
108 | [self.delegate didCreateRSSIAlert:self.alert fromController:self];
109 | }
110 | else
111 | {
112 | self.alert.message = self.message.text;
113 | self.alert.distance = self.rssiSlider.value;
114 |
115 | [self.delegate didUpdateRSSIAlert:self.alert fromController:self];
116 | }
117 | }
118 | else
119 | {
120 | NSString *message = @"The alert requires a message.";
121 | UIAlertView *notificationAlert = [[UIAlertView alloc]initWithTitle:@"Add Message"
122 | message:message
123 | delegate:nil
124 | cancelButtonTitle:@"Ok"
125 | otherButtonTitles:nil];
126 |
127 | [notificationAlert show];
128 | }
129 | }
130 |
131 | - (void)updateRSSIIndicator:(id)sender
132 | {
133 | NSInteger currentRSSIValue = self.rssiSlider.value;
134 | self.rssiIndicator.text = [NSString stringWithFormat:@"%ld dBm", (long)currentRSSIValue];
135 | }
136 |
137 |
138 | @end
139 |
--------------------------------------------------------------------------------
/BLEduino/KeyboardModuleTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KeyboardModuleTableViewController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 10/1/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "KeyboardModuleTableViewController.h"
10 | #import "BDLeManager.h"
11 | #import "BDUart.h"
12 | #import "BDBleduino.h"
13 |
14 | #pragma mark -
15 | #pragma mark Setup
16 | /****************************************************************************/
17 | /* Setup */
18 | /****************************************************************************/
19 | @implementation KeyboardModuleTableViewController
20 |
21 | - (id)initWithStyle:(UITableViewStyle)style
22 | {
23 | self = [super initWithStyle:style];
24 | if (self) {
25 | // Custom initialization
26 | }
27 | return self;
28 | }
29 |
30 | - (void)viewDidLoad
31 | {
32 | [super viewDidLoad];
33 |
34 | self.messageView.delegate = self;
35 | [self.messageView becomeFirstResponder];
36 |
37 | //Set appareance.
38 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
39 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
40 | green:THEME_COLOR_GREEN/255.0
41 | blue:THEME_COLOR_BLUE/255.0
42 | alpha:1.0];
43 |
44 | [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
45 | self.navigationController.navigationBar.barTintColor = lightBlue;
46 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
47 | self.navigationController.navigationBar.translucent = NO;
48 | }
49 |
50 | - (void)didReceiveMemoryWarning
51 | {
52 | [super didReceiveMemoryWarning];
53 | // Dispose of any resources that can be recreated.
54 | }
55 |
56 |
57 | #pragma mark -
58 | #pragma mark TextView Delegate
59 | /****************************************************************************/
60 | /* TextView Delegate */
61 | /****************************************************************************/
62 | - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
63 | {
64 | if([text isEqualToString:@"\n"])
65 | {
66 | [self writeMessage:self.messageView.text];
67 |
68 | //Clear text view.
69 | [textView setContentOffset:CGPointMake(0, 0) animated:YES];
70 | self.messageView.text = @"";
71 | }
72 |
73 | return ([text isEqualToString:@"\n"])?NO:YES;
74 | }
75 |
76 | /*
77 | * This method implements the logic to send messages to the BLEduino's LCD module (via the UART pipe/service),
78 | * regardless of its length.
79 | *
80 | * Bluetooth LE caps trasnfers at 20 bytes. That is, the BLEduino can only receive 20 bytes at a time.
81 | * Therefore, any transfers bigger than that must be splitted in chunks of 20 bytes. This limitation is not handled
82 | * automatically by design. The UART pipe/service is meant to be the most versatile and flexible one, and for that
83 | * reason, we have left the decision on how to best use UART, completely upt to the user. The following, is our
84 | * decision on how to best use it for the Keyboard module.
85 | *
86 | */
87 | - (void) writeMessage:(NSString *)message
88 | {
89 | if(message.length > 20)
90 | {
91 | BOOL lastPacket = false;
92 | NSInteger subsstringPointer = 0;
93 | NSInteger totalPackets = ceil(message.length / 20.0);
94 |
95 | NSData *messageData = [message dataUsingEncoding:NSUTF8StringEncoding];
96 |
97 | for (int packetIndex = 0; packetIndex < totalPackets; packetIndex++)
98 | {
99 | //Check if last (chunk of) transmission.
100 | lastPacket = (packetIndex == (totalPackets-1));
101 |
102 | //Setup range for subset/chunck of data being transfer.
103 | NSInteger rangeLength = (lastPacket)?(message.length - subsstringPointer):20;
104 | NSRange dataRange = NSMakeRange(subsstringPointer, rangeLength);
105 |
106 | //Get substring being tranfer.
107 | NSData *dataSubset = [messageData subdataWithRange:dataRange];
108 |
109 | //Write (part of) message.
110 | [BDBleduino writeValue:dataSubset];
111 |
112 | NSLog(@"\nWrote date from: %ld to: %ld, of %ld characters. \nSubstring: |%@| \nData length: %ld\nData: %@\n\n",
113 | (long)subsstringPointer,
114 | (long)(subsstringPointer+rangeLength),
115 | (long)message.length,
116 | [message substringWithRange:dataRange],
117 | (unsigned long)dataSubset.length,
118 | [dataSubset description]);
119 |
120 | //Move pointer to the beginning of next packet.
121 | subsstringPointer = subsstringPointer + 20;
122 | }
123 | }
124 | else
125 | {
126 | [BDBleduino writeValue:message];
127 | }
128 | }
129 |
130 | - (IBAction)dismissModule
131 | {
132 | [self.delegate keyboardModuleTableViewControllerDismissed:self];
133 | }
134 |
135 | @end
136 |
--------------------------------------------------------------------------------
/BLEduino/PowerSwitchButtonView.m:
--------------------------------------------------------------------------------
1 | //
2 | // PowerSwitchButtonView.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 11/14/13.
6 | // Copyright (c) 2013 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "PowerSwitchButtonView.h"
10 | #import "BDLeManager.h"
11 | #import "BDFirmata.h"
12 |
13 | @interface PowerSwitchButtonView ()
14 | @property CGPoint offset;
15 |
16 | //Setttings
17 | @property (strong) UIColor *statusColor;
18 | @property PowerSwitchStatusColor colorCode;
19 | @end
20 |
21 | @implementation PowerSwitchButtonView
22 |
23 | - (void) initPowerSwitch
24 | {
25 | //Set appareance.
26 | self.layer.borderColor = [UIColor darkGrayColor].CGColor;
27 | self.layer.borderWidth = 0.8f;
28 |
29 | //Update module based on settings.
30 | self.colorCode = [[NSUserDefaults standardUserDefaults] integerForKey:SETTINGS_POWERRELAY_STATUS_COLOR];
31 | if(self.colorCode == PowerSwitchStatusColorBlue)
32 | {
33 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
34 | green:THEME_COLOR_GREEN/255.0
35 | blue:THEME_COLOR_BLUE/255.0
36 | alpha:1.0];
37 |
38 | self.statusColor = lightBlue;
39 | }
40 | else
41 | {
42 | UIColor *lightGreen = [UIColor colorWithRed:0 green:200/255.0 blue:0 alpha:1.0];
43 | self.statusColor = lightGreen;
44 | }
45 |
46 | UILabel *switchMessage = (UILabel*)[self viewWithTag:100];
47 | //Red because we are starting on OFF (red) state.
48 | [switchMessage setTextColor:[UIColor redColor]];
49 | }
50 |
51 | - (id)initWithFrame:(CGRect)frame
52 | {
53 | self = [super initWithFrame:frame];
54 | if (self) {
55 | // Initialization code
56 | [self initPowerSwitch];
57 | }
58 | return self;
59 | }
60 |
61 | - (id)initWithCoder:(NSCoder*)coder
62 | {
63 | if ((self = [super initWithCoder:coder])) {
64 | // Initialization code
65 | [self initPowerSwitch];
66 | //[self setFrame:CGRectMake(10, 10, 300, 245)];
67 | }
68 | return self;
69 | }
70 |
71 | //Send firmata command.
72 | - (void)switchPowerOn
73 | {
74 | [self.delegate powerSwitchDidUpdateWithStateOn:YES];
75 | }
76 |
77 | - (void)switchPowerOff
78 | {
79 | [self.delegate powerSwitchDidUpdateWithStateOn:NO];
80 | }
81 |
82 | - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
83 | {
84 | UITouch *aTouch = [touches anyObject];
85 |
86 | self.offset = [aTouch locationInView: self];
87 | }
88 |
89 | -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
90 | {
91 | UITouch *aTouch = [touches anyObject];
92 | CGPoint location = [aTouch locationInView:self.superview];
93 |
94 | CGRect newFrame = CGRectMake(self.frame.origin.x, location.y - self.offset.y,
95 | self.frame.size.width, self.frame.size.height);
96 |
97 | //Verify new location is within dragging space.
98 | if(newFrame.origin.y >= 10 && newFrame.origin.y <= 250)
99 | {
100 | [UIView beginAnimations:@"Dragging Power Switch" context:nil];
101 | self.frame =newFrame;
102 | [UIView commitAnimations];
103 | }
104 |
105 | NSLog(@"height: %f", self.frame.size.height);
106 | }
107 |
108 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
109 | {
110 | BOOL isOnTopHalf = (self.center.y < 252)?YES:NO;
111 | [self updatePowerSwitchView:isOnTopHalf];
112 | }
113 |
114 |
115 | - (void)updatePowerSwitchView:(BOOL)isOnTopHalf
116 | {
117 | NSString *text;
118 | UIColor *color;
119 | CGRect newFrame;
120 |
121 | //Update status message.
122 | UILabel *switchMessage = (UILabel*)[self viewWithTag:100];
123 |
124 | if(isOnTopHalf)
125 | {
126 | [self switchPowerOn];
127 | text = @"ON";
128 | color = self.statusColor;
129 | newFrame = CGRectMake(self.frame.origin.x, 10,
130 | self.frame.size.width, self.frame.size.height);
131 |
132 | }
133 | else
134 | {
135 | [self switchPowerOff];
136 | text = @"OFF";
137 | color = (self.colorCode == PowerSwitchStatusColorGreenRed)?[UIColor redColor]:self.statusColor;
138 | newFrame = CGRectMake(self.frame.origin.x, 568 - (self.frame.size.height) - 10 - 63,
139 | self.frame.size.width, self.frame.size.height);
140 | }
141 |
142 | //Execute update.
143 | [UIView beginAnimations:@"Dragging Power Switch" context:nil];
144 | self.frame = newFrame;
145 | switchMessage.text = text;
146 | switchMessage.textColor = color;
147 | [UIView setAnimationDuration:0.3];
148 | [UIView commitAnimations];
149 | }
150 |
151 | - (void)updatePowerSwitchTextWithStateOn:(BOOL)isOn
152 | {
153 | NSString *text;
154 | UIColor *color;
155 |
156 | //Update status message.
157 | UILabel *switchMessage = (UILabel*)[self viewWithTag:100];
158 |
159 | if(isOn)
160 | {
161 | text = @"ON";
162 | color = self.statusColor;
163 | }
164 | else
165 | {
166 | text = @"OFF";
167 | color = (self.colorCode == PowerSwitchStatusColorGreenRed)?[UIColor redColor]:self.statusColor;
168 | }
169 |
170 | //Execute update.
171 | [UIView beginAnimations:@"Dragging Power Switch" context:nil];
172 | switchMessage.text = text;
173 | switchMessage.textColor = color;
174 | [UIView setAnimationDuration:0.3];
175 | [UIView commitAnimations];
176 | }
177 |
178 | @end
179 |
--------------------------------------------------------------------------------
/BLEduino/ProximityRSSISettingsController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ProximityRSSISettingsController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 8/11/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "ProximityRSSISettingsController.h"
10 | #import "BDProximity.h"
11 |
12 | @interface ProximityRSSISettingsController ()
13 |
14 | @end
15 |
16 | @implementation ProximityRSSISettingsController
17 |
18 | - (id)initWithStyle:(UITableViewStyle)style
19 | {
20 | self = [super initWithStyle:style];
21 | if (self) {
22 | // Custom initialization
23 | }
24 | return self;
25 | }
26 |
27 | - (void)viewDidLoad
28 | {
29 | [super viewDidLoad];
30 |
31 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
32 | float immediateRSSI = [defaults floatForKey:PROXIMITY_RSSI_IMMEDIATE_RANGE];
33 | float nearRSSI = [defaults floatForKey:PROXIMITY_RSSI_NEAR_RANGE];
34 | float farRSSI = [defaults floatForKey:PROXIMITY_RSSI_FAR_RANGE];
35 | [defaults synchronize];
36 |
37 | //Setup immediate slider update method.
38 | self.immediateSlider.value = immediateRSSI;
39 | self.immediateSlider.continuous = YES;
40 | [self.immediateSlider addTarget:self
41 | action:@selector(updateImmediateRSSIIndicator:)
42 | forControlEvents:UIControlEventValueChanged];
43 |
44 | //Setup near slider update method.
45 | self.nearSlider.value = nearRSSI;
46 | self.nearSlider.continuous = YES;
47 | [self.nearSlider addTarget:self
48 | action:@selector(updateNearRSSIIndicator:)
49 | forControlEvents:UIControlEventValueChanged];
50 |
51 | //Setup far slider update method.
52 | self.farSlider.value = farRSSI;
53 | self.farSlider.continuous = YES;
54 | [self.farSlider addTarget:self
55 | action:@selector(updateFarRSSIIndicator:)
56 | forControlEvents:UIControlEventValueChanged];
57 |
58 | self.immediateLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)immediateRSSI];
59 | self.nearLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)nearRSSI];
60 | self.farLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)farRSSI];
61 |
62 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
63 | green:THEME_COLOR_GREEN/255.0
64 | blue:THEME_COLOR_BLUE/255.0
65 | alpha:1.0];
66 |
67 | //Set Color
68 | self.immediateSlider.tintColor = lightBlue;
69 | self.nearSlider.tintColor = lightBlue;
70 | self.farSlider.tintColor = lightBlue;
71 |
72 | //Set Footer
73 | BDProximity *monitor = [BDProximity sharedMonitor];
74 | NSInteger measuredPower = [monitor.measuredPower integerValue];
75 | UILabel *footer = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
76 | [footer setTextAlignment:NSTextAlignmentCenter];
77 | [footer setLineBreakMode:NSLineBreakByWordWrapping];
78 | [footer setTextColor:lightBlue];
79 | [footer setFont:[UIFont systemFontOfSize:15]];
80 | footer.text = [NSString stringWithFormat:@"Meassured Power: %lddBM", (long)measuredPower];
81 | self.tableView.tableFooterView = footer;
82 |
83 | //Setup header
84 | UILabel *header = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 10)];
85 | self.tableView.tableHeaderView = header;
86 | }
87 |
88 | - (void)updateImmediateRSSIIndicator:(id)slider
89 | {
90 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
91 | [defaults setObject:[NSNumber numberWithFloat:self.immediateSlider.value] forKey:PROXIMITY_RSSI_IMMEDIATE_RANGE];
92 |
93 | NSInteger currentRSSIValue = self.immediateSlider.value;
94 | self.immediateLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)currentRSSIValue];
95 | }
96 |
97 | - (void)updateNearRSSIIndicator:(id)slider
98 | {
99 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
100 | [defaults setObject:[NSNumber numberWithFloat:self.nearSlider.value] forKey:PROXIMITY_RSSI_IMMEDIATE_RANGE];
101 |
102 | NSInteger currentRSSIValue = self.nearSlider.value;
103 | self.nearLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)currentRSSIValue];
104 | }
105 |
106 | - (void)updateFarRSSIIndicator:(id)slider
107 | {
108 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
109 | [defaults setObject:[NSNumber numberWithFloat:self.farSlider.value] forKey:PROXIMITY_RSSI_IMMEDIATE_RANGE];
110 |
111 | NSInteger currentRSSIValue = self.farSlider.value;
112 | self.farLabel.text = [NSString stringWithFormat:@"%ld dBm", (long)currentRSSIValue];
113 | }
114 |
115 |
116 | - (void)viewWillDisappear:(BOOL)animated
117 | {
118 | //Store everything.
119 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
120 | [defaults setFloat:self.immediateSlider.value forKey:PROXIMITY_RSSI_IMMEDIATE_RANGE];
121 | [defaults setFloat:self.nearSlider.value forKey:PROXIMITY_RSSI_NEAR_RANGE];
122 | [defaults setFloat:self.farSlider.value forKey:PROXIMITY_RSSI_FAR_RANGE];
123 | [defaults synchronize];
124 |
125 | //Update the proximity monitor.
126 | BDProximity *monitor = [BDProximity sharedMonitor];
127 | monitor.immediateRSSI = self.immediateSlider.value;
128 | monitor.nearRSSI = self.nearSlider.value;
129 | monitor.farRSSI = self.farSlider.value;
130 | }
131 |
132 | - (void)didReceiveMemoryWarning
133 | {
134 | [super didReceiveMemoryWarning];
135 | // Dispose of any resources that can be recreated.
136 | }
137 |
138 | @end
139 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/valerieann.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
40 |
52 |
53 |
54 |
56 |
68 |
69 |
70 |
72 |
84 |
85 |
86 |
88 |
100 |
101 |
102 |
104 |
116 |
117 |
118 |
120 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/BLEduino.xcodeproj/xcuserdata/ramongonzalez.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
40 |
52 |
53 |
54 |
56 |
68 |
69 |
70 |
72 |
84 |
85 |
86 |
88 |
100 |
101 |
102 |
104 |
116 |
117 |
118 |
120 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/Libraries/OBShapedButton/OBShapedButton.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009 Ole Begemann
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | /*
24 | OBShapedButton.m
25 |
26 | Created by Ole Begemann
27 | October, 2009
28 | */
29 |
30 | #import "OBShapedButton.h"
31 | #import "UIImage+ColorAtPixel.h"
32 |
33 | @interface OBShapedButton ()
34 |
35 | @property (nonatomic, assign) CGPoint previousTouchPoint;
36 | @property (nonatomic, assign) BOOL previousTouchHitTestResponse;
37 | @property (nonatomic, strong) UIImage *buttonImage;
38 | @property (nonatomic, strong) UIImage *buttonBackground;
39 |
40 | - (void)updateImageCacheForCurrentState;
41 | - (void)resetHitTestCache;
42 |
43 | @end
44 |
45 |
46 | @implementation OBShapedButton
47 |
48 | - (id)initWithFrame:(CGRect)frame
49 | {
50 | self = [super initWithFrame:frame];
51 | if (self) {
52 | [self setup];
53 | }
54 | return self;
55 | }
56 |
57 | - (void)awakeFromNib
58 | {
59 | [self setup];
60 | }
61 |
62 | - (void)setup
63 | {
64 | [self updateImageCacheForCurrentState];
65 | [self resetHitTestCache];
66 | }
67 |
68 | #pragma mark - Hit testing
69 |
70 | - (BOOL)isAlphaVisibleAtPoint:(CGPoint)point forImage:(UIImage *)image
71 | {
72 | // Correct point to take into account that the image does not have to be the same size
73 | // as the button. See https://github.com/ole/OBShapedButton/issues/1
74 | CGSize iSize = image.size;
75 | CGSize bSize = self.bounds.size;
76 | point.x *= (bSize.width != 0) ? (iSize.width / bSize.width) : 1;
77 | point.y *= (bSize.height != 0) ? (iSize.height / bSize.height) : 1;
78 |
79 | UIColor *pixelColor = [image colorAtPixel:point];
80 | CGFloat alpha = 0.0;
81 |
82 | if ([pixelColor respondsToSelector:@selector(getRed:green:blue:alpha:)])
83 | {
84 | // available from iOS 5.0
85 | [pixelColor getRed:NULL green:NULL blue:NULL alpha:&alpha];
86 | }
87 | else
88 | {
89 | // for iOS < 5.0
90 | // In iOS 6.1 this code is not working in release mode, it works only in debug
91 | // CGColorGetAlpha always return 0.
92 | CGColorRef cgPixelColor = [pixelColor CGColor];
93 | alpha = CGColorGetAlpha(cgPixelColor);
94 | }
95 | return alpha >= kAlphaVisibleThreshold;
96 | }
97 |
98 |
99 | // UIView uses this method in hitTest:withEvent: to determine which subview should receive a touch event.
100 | // If pointInside:withEvent: returns YES, then the subview’s hierarchy is traversed; otherwise, its branch
101 | // of the view hierarchy is ignored.
102 | - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
103 | {
104 | // Return NO if even super returns NO (i.e., if point lies outside our bounds)
105 | BOOL superResult = [super pointInside:point withEvent:event];
106 | if (!superResult) {
107 | return superResult;
108 | }
109 |
110 | // Don't check again if we just queried the same point
111 | // (because pointInside:withEvent: gets often called multiple times)
112 | if (CGPointEqualToPoint(point, self.previousTouchPoint)) {
113 | return self.previousTouchHitTestResponse;
114 | } else {
115 | self.previousTouchPoint = point;
116 | }
117 |
118 | BOOL response = NO;
119 |
120 | if (self.buttonImage == nil && self.buttonBackground == nil) {
121 | response = YES;
122 | }
123 | else if (self.buttonImage != nil && self.buttonBackground == nil) {
124 | response = [self isAlphaVisibleAtPoint:point forImage:self.buttonImage];
125 | }
126 | else if (self.buttonImage == nil && self.buttonBackground != nil) {
127 | response = [self isAlphaVisibleAtPoint:point forImage:self.buttonBackground];
128 | }
129 | else {
130 | if ([self isAlphaVisibleAtPoint:point forImage:self.buttonImage]) {
131 | response = YES;
132 | } else {
133 | response = [self isAlphaVisibleAtPoint:point forImage:self.buttonBackground];
134 | }
135 | }
136 |
137 | self.previousTouchHitTestResponse = response;
138 | return response;
139 | }
140 |
141 |
142 | #pragma mark - Accessors
143 |
144 | // Reset the Hit Test Cache when a new image is assigned to the button
145 | - (void)setImage:(UIImage *)image forState:(UIControlState)state
146 | {
147 | [super setImage:image forState:state];
148 | [self updateImageCacheForCurrentState];
149 | [self resetHitTestCache];
150 | }
151 |
152 | - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state
153 | {
154 | [super setBackgroundImage:image forState:state];
155 | [self updateImageCacheForCurrentState];
156 | [self resetHitTestCache];
157 | }
158 |
159 | - (void)setEnabled:(BOOL)enabled
160 | {
161 | [super setEnabled:enabled];
162 | [self updateImageCacheForCurrentState];
163 | }
164 |
165 | - (void)setHighlighted:(BOOL)highlighted
166 | {
167 | [super setHighlighted:highlighted];
168 | [self updateImageCacheForCurrentState];
169 | }
170 |
171 | - (void)setSelected:(BOOL)selected
172 | {
173 | [super setSelected:selected];
174 | [self updateImageCacheForCurrentState];
175 | }
176 |
177 |
178 | #pragma mark - Helper methods
179 |
180 | - (void)updateImageCacheForCurrentState
181 | {
182 | _buttonBackground = [self currentBackgroundImage];
183 | _buttonImage = [self currentImage];
184 | }
185 |
186 | - (void)resetHitTestCache
187 | {
188 | self.previousTouchPoint = CGPointMake(CGFLOAT_MIN, CGFLOAT_MIN);
189 | self.previousTouchHitTestResponse = NO;
190 | }
191 |
192 | @end
193 |
--------------------------------------------------------------------------------
/BLEduino/DistanceAlertController.m:
--------------------------------------------------------------------------------
1 | //
2 | // EditDistanceAlertController.m
3 | // BLEduino
4 | //
5 | // Created by Ramon Gonzalez on 7/18/14.
6 | // Copyright (c) 2014 Kytelabs. All rights reserved.
7 | //
8 |
9 | #import "DistanceAlertController.h"
10 |
11 | @interface DistanceAlertController ()
12 |
13 | @end
14 |
15 | @implementation DistanceAlertController
16 |
17 | - (id)initWithStyle:(UITableViewStyle)style
18 | {
19 | self = [super initWithStyle:style];
20 | if (self) {
21 | // Custom initialization
22 | }
23 | return self;
24 | }
25 |
26 | - (void)viewDidLoad
27 | {
28 | [super viewDidLoad];
29 |
30 | //Set appareance.
31 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
32 | UIColor *lightBlue = [UIColor colorWithRed:THEME_COLOR_RED/255.0
33 | green:THEME_COLOR_GREEN/255.0
34 | blue:THEME_COLOR_BLUE/255.0
35 | alpha:1.0];
36 |
37 | [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
38 | self.navigationController.navigationBar.barTintColor = lightBlue;
39 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
40 | self.navigationController.navigationBar.translucent = NO;
41 |
42 | self.distanceControl.tintColor = lightBlue;
43 |
44 | //Set message delegate
45 | self.message.delegate = self;
46 |
47 | //If it is an update
48 | if(!self.isNewAlert)
49 | {
50 | //Populate with data of alert to be updated.
51 | self.message.text = self.alert.message;
52 | self.distanceControl.selectedSegmentIndex = self.alert.distance;
53 | }
54 |
55 | //If it is an update
56 | if(!self.isNewAlert)
57 | {
58 | //Populate with data of alert to be updated.
59 | self.message.text = self.alert.message;
60 | [self.alertWhenCloser setOn:self.alert.bleduinoIsCloser animated:NO];
61 | [self.alertWhenFarther setOn:self.alert.bleduinoIsFarther animated:NO];
62 |
63 | switch (self.alert.distance) {
64 | case 4:
65 | self.distanceControl.selectedSegmentIndex = 0;
66 | break;
67 | case 2:
68 | self.distanceControl.selectedSegmentIndex = 1;
69 | break;
70 | case 1:
71 | self.distanceControl.selectedSegmentIndex = 2;
72 | break;
73 | default:
74 | self.distanceControl.selectedSegmentIndex = 2;
75 | break;
76 | }
77 | }
78 |
79 | //First alert?
80 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
81 | BOOL isFirstAlert = [defaults boolForKey:PROXIMITY_FIRST_ALERT];
82 | if(isFirstAlert)
83 | {
84 | NSString *message = @"Proximity alerts are only supported on the foreground. That is, you must have the application open for them to work.";
85 | UIAlertView *firstAlert = [[UIAlertView alloc]initWithTitle:@"Proximity Alerts"
86 | message:message
87 | delegate:nil
88 | cancelButtonTitle:@"Ok"
89 | otherButtonTitles:nil];
90 | [firstAlert show];
91 | }
92 | }
93 |
94 | - (void)didReceiveMemoryWarning
95 | {
96 | [super didReceiveMemoryWarning];
97 | // Dispose of any resources that can be recreated.
98 | }
99 |
100 | - (IBAction)dismissModule:(id)sender
101 | {
102 | [self.delegate distanceAlertControllerDismissed:self];
103 | }
104 |
105 | - (BOOL)textFieldShouldReturn:(UITextField *)textField
106 | {
107 | [self.message resignFirstResponder];
108 | return NO;
109 | }
110 |
111 | - (IBAction)updateDistanceAlert:(id)sender
112 | {
113 | if(self.message.text.length > 0)
114 | {
115 | if(self.isNewAlert)
116 | {
117 | self.alert = [[ProximityAlert alloc] init];
118 | self.alert.message = self.message.text;
119 | self.alert.bleduinoIsCloser = self.alertWhenCloser.isOn;
120 | self.alert.bleduinoIsFarther = self.alertWhenFarther.isOn;
121 | self.alert.isDistanceAlert = YES;
122 |
123 | switch (self.distanceControl.selectedSegmentIndex) {
124 | case 0:
125 | self.alert.distance = 4;
126 | break;
127 | case 1:
128 | self.alert.distance = 2;
129 | break;
130 | case 2:
131 | self.alert.distance = 1;
132 | break;
133 | default:
134 | self.alert.distance = 0;
135 | break;
136 | }
137 |
138 | [self.delegate didCreateDistanceAlert:self.alert fromController:self];
139 | }
140 | else
141 | {
142 | self.alert.message = self.message.text;
143 | self.alert.bleduinoIsCloser = self.alertWhenCloser.isOn;
144 | self.alert.bleduinoIsFarther = self.alertWhenFarther.isOn;
145 |
146 | switch (self.distanceControl.selectedSegmentIndex) {
147 | case 0:
148 | self.alert.distance = 4;
149 | break;
150 | case 1:
151 | self.alert.distance = 2;
152 | break;
153 | case 2:
154 | self.alert.distance = 1;
155 | break;
156 | default:
157 | self.alert.distance = 0;
158 | break;
159 | }
160 |
161 | [self.delegate didUpdateDistanceAlert:self.alert fromController:self];
162 | }
163 | }
164 | else
165 | {
166 | NSString *message = @"The alert requires a message.";
167 | UIAlertView *notificationAlert = [[UIAlertView alloc]initWithTitle:@"Add Message"
168 | message:message
169 | delegate:nil
170 | cancelButtonTitle:@"Ok"
171 | otherButtonTitles:nil];
172 |
173 | [notificationAlert show];
174 | }
175 | }
176 |
177 | @end
178 |
--------------------------------------------------------------------------------