Changed a lot, added all current commands in a debug way...

This commit is contained in:
Lukas Bachschwell 2016-07-29 21:34:39 +02:00
parent ab093d66f5
commit 78dd5e3792
7 changed files with 289 additions and 57 deletions

View File

@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
2B08A22F1BB48CF300B0B8B1 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B08A22D1BB48CF300B0B8B1 /* Main_iPhone.storyboard */; settings = {ASSET_TAGS = (); }; };
2B08A22F1BB48CF300B0B8B1 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B08A22D1BB48CF300B0B8B1 /* Main_iPhone.storyboard */; };
2BBC018F1981879400D0BAE0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC018E1981879400D0BAE0 /* Foundation.framework */; };
2BBC01911981879400D0BAE0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01901981879400D0BAE0 /* CoreGraphics.framework */; };
2BBC01931981879400D0BAE0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01921981879400D0BAE0 /* UIKit.framework */; };
@ -24,8 +24,8 @@
2BBC01C7198187B600D0BAE0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01C6198187B600D0BAE0 /* AudioToolbox.framework */; };
2BBC01C9198187C300D0BAE0 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01C8198187C300D0BAE0 /* CoreBluetooth.framework */; };
2BBC01CC198187EB00D0BAE0 /* SerialGATT.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC01CA198187EB00D0BAE0 /* SerialGATT.m */; };
2BC70F0D1BD2242800330A1F /* Icon@2x copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */; settings = {ASSET_TAGS = (); }; };
2BEEF2401BD7FAAB00003449 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */; settings = {ASSET_TAGS = (); }; };
2BC70F0D1BD2242800330A1F /* Icon@2x copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */; };
2BEEF2401BD7FAAB00003449 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@ -14,7 +14,7 @@
<viewControllerLayoutGuide type="bottom" id="ODW-V1-bRC"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RzV-q3-whK">
@ -26,8 +26,89 @@
<action selector="connect:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="0eN-6F-lZb"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Commands" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gdW-7D-K7k">
<rect key="frame" x="146" y="111" width="88" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Filename" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CFE-n4-fVE">
<rect key="frame" x="74" y="139" width="69" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Data Value" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p35-MF-zfi">
<rect key="frame" x="245" y="139" width="83" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Y0c-XX-now">
<rect key="frame" x="242" y="174" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="dismiss:" destination="vXZ-lx-hvc" eventType="touchCancel" id="2tJ-ro-nvC"/>
</connections>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="6Ho-9A-Hn2">
<rect key="frame" x="60" y="174" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="dismiss:" destination="vXZ-lx-hvc" eventType="touchCancel" id="U1c-SJ-vcM"/>
</connections>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ega-iL-c02">
<rect key="frame" x="255" y="83" width="65" height="30"/>
<state key="normal" title="Drink List"/>
<connections>
<action selector="listDrinks:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="xBK-LE-APk"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="not Connected" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8HX-K5-jdU">
<rect key="frame" x="230" y="32" width="114" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lHu-Pd-1h1">
<rect key="frame" x="50" y="83" width="61" height="30"/>
<state key="normal" title="User List"/>
<connections>
<action selector="listUsers:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="VKc-oX-oKF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lv4-HT-RNP">
<rect key="frame" x="159" y="59" width="67" height="30"/>
<state key="normal" title="ScanUser"/>
<connections>
<action selector="startScan:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="hJh-UJ-uSH"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JdK-2V-Lcm">
<rect key="frame" x="162" y="135" width="57" height="30"/>
<state key="normal" title="GetUser"/>
<connections>
<action selector="getUser:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="f2u-NX-xzT"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="Rmh-Kb-0Vi">
<rect key="frame" x="0.0" y="221" width="375" height="294"/>
<color key="backgroundColor" red="1" green="0.9880517675814775" blue="0.24115761723077578" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qcB-Tf-qyF">
<rect key="frame" x="178" y="192" width="36" height="30"/>
<state key="normal" title="Clear"/>
<connections>
<action selector="clearOutput:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="gt1-8v-eOc"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="n2u-Pj-bkX">
<rect key="frame" x="86" y="395" width="149" height="30"/>
<rect key="frame" x="60" y="619" width="91" height="30"/>
<state key="normal" title="Create User">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
@ -35,56 +116,91 @@
<action selector="createUser:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Dxc-IU-yJN"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Debug and old stuff" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gdW-7D-K7k">
<rect key="frame" x="84" y="320" width="152" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Y0c-XX-now">
<rect key="frame" x="110" y="357" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CaP-0X-oLM">
<rect key="frame" x="242" y="629" width="91" height="30"/>
<state key="normal" title="Delete User">
<color key="titleColor" red="1" green="0.15433702551952466" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dismiss:" destination="vXZ-lx-hvc" eventType="touchCancel" id="2tJ-ro-nvC"/>
</connections>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ega-iL-c02">
<rect key="frame" x="126" y="102" width="65" height="30"/>
<state key="normal" title="Drink List"/>
<connections>
<action selector="listDrinks:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="xBK-LE-APk"/>
<action selector="removeUser:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="gqE-fG-I79"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="not Connected" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8HX-K5-jdU">
<rect key="frame" x="186" y="32" width="114" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lHu-Pd-1h1">
<rect key="frame" x="126" y="140" width="61" height="30"/>
<state key="normal" title="User List"/>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vCr-pM-XmR">
<rect key="frame" x="60" y="536" width="91" height="30"/>
<state key="normal" title="Set Credits">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="setCredits:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="5AG-8m-VAV"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="egj-vx-Kd5">
<rect key="frame" x="60" y="574" width="91" height="30"/>
<state key="normal" title="SetName">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="setName:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="nlD-ZD-m5U"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6Lh-Ga-6ln">
<rect key="frame" x="99" y="454" width="122" height="30"/>
<state key="normal" title="Revoke RFID Chip"/>
<rect key="frame" x="243" y="574" width="86" height="30"/>
<state key="normal" title="Revoke RFID"/>
<connections>
<action selector="revokeRFID:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="U06-XH-32h"/>
<action selector="revokeRFID:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="1i3-5c-QoK"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dIO-3e-cRw">
<rect key="frame" x="238" y="536" width="97" height="30"/>
<state key="normal" title="Revoke Finger"/>
<connections>
<action selector="revokeFinger:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="GDw-lw-lcr"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections>
<outlet property="nameEntry" destination="Y0c-XX-now" id="LPs-Of-h1P"/>
<outlet property="dataEntry" destination="Y0c-XX-now" id="L68-75-bTg"/>
<outlet property="fileEntry" destination="6Ho-9A-Hn2" id="Eed-lU-nhT"/>
<outlet property="output" destination="Rmh-Kb-0Vi" id="DOq-VA-KcS"/>
<outlet property="status" destination="8HX-K5-jdU" id="MwC-mW-kXG"/>
<segue destination="wVH-q0-hcT" kind="modal" id="Upv-Wv-bBu"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="437" y="389"/>
<point key="canvasLocation" x="509.5" y="186.5"/>
</scene>
<!--Table View Controller-->
<scene sceneID="My2-3N-QaI">
<objects>
<tableViewController storyboardIdentifier="tableView" id="wVH-q0-hcT" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="53" sectionHeaderHeight="28" sectionFooterHeight="28" id="Lir-IV-gYq">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="userCell" rowHeight="53" id="Imu-Q3-K8P">
<rect key="frame" x="0.0" y="28" width="375" height="53"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Imu-Q3-K8P" id="iIV-7d-xpq">
<rect key="frame" x="0.0" y="0.0" width="375" height="52"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="wVH-q0-hcT" id="SY0-83-QYy"/>
<outlet property="delegate" destination="wVH-q0-hcT" id="nUl-1P-KO9"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jco-cW-Wmq" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="924" y="187"/>
</scene>
</scenes>
</document>

View File

@ -71,6 +71,11 @@
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
@ -16,7 +16,6 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>

View File

@ -10,23 +10,32 @@
#import "SerialGATT.h"
@interface ViewController : UIViewController<BTSmartSensorDelegate, UITextFieldDelegate>
@interface ViewController : UIViewController<BTSmartSensorDelegate, UITextFieldDelegate, UITableViewDataSource, UITextFieldDelegate>
@property (strong, nonatomic) SerialGATT *btControl;
@property (strong, nonatomic) CBPeripheral *box;
@property Boolean connected;
- (IBAction)connect:(id)sender;
- (IBAction)sendMsgToArduino:(id)sender;
- (IBAction)checkCount:(id)sender;
- (IBAction)removeUser:(id)sender;
- (IBAction)listUsers:(id)sender;
- (IBAction)listDrinks:(id)sender;
- (IBAction)startScan:(id)sender;
- (IBAction)getUser:(id)sender;
- (IBAction)revokeRFID:(id)sender;
- (IBAction)revokeFinger:(id)sender;
- (IBAction)setCredits:(id)sender;
- (IBAction)setName:(id)sender;
- (IBAction)removeUser:(id)sender;
- (IBAction)clearOutput:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *status;
@property (weak, nonatomic) IBOutlet UITextField *nameEntry;
@property (weak, nonatomic) IBOutlet UITextField *fileEntry;
@property (weak, nonatomic) IBOutlet UITextField *dataEntry;
@property (weak, nonatomic) IBOutlet UITextView *output;
@end

View File

@ -14,7 +14,7 @@
@implementation ViewController
@synthesize btControl, box, status;
@synthesize btControl, box, status, connected;
- (void)viewDidLoad
{
@ -25,8 +25,8 @@
[btControl setup];
btControl.delegate = self;
[_nameEntry setDelegate:self];
[_dataEntry setDelegate:self];
[_fileEntry setDelegate:self];
}
- (void)didReceiveMemoryWarning
@ -58,20 +58,104 @@
}
-(void) serialGATTCharValueUpdated:(NSString *)UUID value:(NSData *)data {
NSString *value = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
[[[UIAlertView alloc] initWithTitle:@"RCV!" message:value delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show];
NSString *retstring = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
//[[[UIAlertView alloc] initWithTitle:@"RCV!" message:retstring delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show];
//parseValue here
_output.text = [_output.text stringByAppendingString:retstring];
/*
NSData *retdata = [retstring dataUsingEncoding:[NSString defaultCStringEncoding]];
NSError *e = nil;
NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: retdata options: NSJSONReadingMutableContainers error: &e];
if (!jsonArray) {
NSLog(@"Error parsing JSON: %@", e);
} else {
for(NSDictionary *item in jsonArray) {
NSLog(@"Item: %@", item);
}
}
*/
}
- (IBAction)clearOutput:(id)sender{
_output.text = @"";
}
- (IBAction)listDrinks:(id)sender {
if(self.connected){
//NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text];
[self sendString:@"#1;"];
}else{
[[[UIAlertView alloc] initWithTitle:@"Error" message:@"BeerBox not connected!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show];
}
}
- (IBAction)listUsers:(id)sender {
if(self.connected){
//NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text];
[self sendString:@"#2;"];
}else{
[[[UIAlertView alloc] initWithTitle:@"Error" message:@"BeerBox not connected!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show];
}
/*
UITableViewController* tab =[self.storyboard instantiateViewControllerWithIdentifier:@"tableView"];
//tab.anotherString = self.originalString;
[tab.tableView setDelegate:self];
[tab.tableView setDataSource:self];
[self presentViewController:tab animated:YES completion:nil];
*/
}
- (IBAction)startScan:(id)sender{
if(self.connected){
//NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text];
[self sendString:@"!3;"];
}else{
[[[UIAlertView alloc] initWithTitle:@"Error" message:@"BeerBox not connected!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show];
}
}
- (IBAction)getUser:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!2%@;",_fileEntry.text];
[self sendString:sendString];
}
- (IBAction)createUser:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text];
NSString *sendString = [NSString stringWithFormat:@"!1%@;",_dataEntry.text];
[self sendString:sendString];
}
- (IBAction)removeUser:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!6%@;",_fileEntry.text];
[self sendString:sendString];
}
- (IBAction)setCredits:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!7%@;%@;",_fileEntry.text,_dataEntry.text];
[self sendString:sendString];
}
- (IBAction)setName:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!8%@;%@;",_fileEntry.text,_dataEntry.text];
[self sendString:sendString];
}
- (IBAction)revokeRFID:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!5%@;",_fileEntry.text];
[self sendString:sendString];
}
- (IBAction)revokeFinger:(id)sender {
NSString *sendString = [NSString stringWithFormat:@"!4%@;",_fileEntry.text];
[self sendString:sendString];
}
- (void) sendString:(NSString*)sendString{
NSData *data = [sendString dataUsingEncoding:[NSString defaultCStringEncoding]];
if(data.length > 20)
@ -98,11 +182,11 @@
//NSData *data = [MsgToArduino.text dataUsingEncoding:[NSString defaultCStringEncoding]];
[btControl write:box data:data];
}
}
/*
- (IBAction)revokeRFID:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Revoke RFID" message:@"Enter an ID" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
@ -113,6 +197,7 @@
[[alert textFieldAtIndex:0] setKeyboardType:UIKeyboardTypePhonePad];
[[alert textFieldAtIndex:0] becomeFirstResponder];
}
*/
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
// The user created a new item, add it
@ -133,12 +218,14 @@
{
[[[UIAlertView alloc] initWithTitle:@"Found!" message:@"BeerBox found!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
status.text=@"Connected!";
self.connected = true;
}
-(void)setDisconnect
{
[[[UIAlertView alloc] initWithTitle:@"Lost!" message:@"BeerBox lost :-(" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
status.text=@"not Connected";
self.connected = false;
}
@ -147,6 +234,22 @@
return NO;
}
//####### Table View stuff
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *protoID = @"userCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:protoID];
cell.textLabel.text = @"Lol";
return cell;
}
@end