Commit ab1c70aa authored by Alex Moore's avatar Alex Moore

Updated SDK Demo with additional error handling, tweaked switch setting

parent e0ac4461
......@@ -107,7 +107,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="gTV-sy-x6A">
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gTV-sy-x6A">
<rect key="frame" x="177" y="351" width="51" height="31"/>
<connections>
<action selector="toggleSledBeeper:" destination="BYZ-38-t0r" eventType="valueChanged" id="zyZ-bn-uMe"/>
......
......@@ -29,7 +29,51 @@
- (void)initCaptuvoSDK
{
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self] ;
[[Captuvo sharedCaptuvoDevice] startDecoderHardware];
ProtocolConnectionStatus status = [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
// switch (status) {
// case ProtocolConnectionStatusAlreadyConnected:
// printf("ProtocolConnectionStatusAlreadyConnected\n");
// break;
// case ProtocolConnectionStatusBatteryDepleted:
// printf("ProtocolConnectionStatusBatteryDepleted\n");
// break;
// case ProtocolConnectionStatusConnected:
// printf("ProtocolConnectionStatusConnected\n");
// break;
// case ProtocolConnectionStatusUnableToConnect:
// printf("ProtocolConnectionStatusUnableToConnect\n");
// break;
// case ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware:
// printf("ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware\n");
// break;
// default:
// printf("ERROR\n");
// break;
// }
if (status == ProtocolConnectionStatusUnableToConnect) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - unknown communication error."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
else if (status == ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - incompatible sled firmware."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
else if (status == ProtocolConnectionStatusBatteryDepleted) {
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - battery depleted."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
}
[[Captuvo sharedCaptuvoDevice] requestBatteryVoltage] ;
[[Captuvo sharedCaptuvoDevice] requestChargeStatus] ;
......@@ -43,10 +87,10 @@
}
- (IBAction)toggleSledBeeper:(id)sender {
if (self.sledBeeperSwitch.on) {
if (!self.sledBeeperSwitch.on) {
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:NO];
}
else if (!self.sledBeeperSwitch.on) {
else if (self.sledBeeperSwitch.on) {
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:NO];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment