//
Pastiebin
New Pastie
View Pasties
SVC.h #import <UIKit/UIKit.h> #import \"PeripheralManager.h\" @interface MeBleSecondViewController : UIViewController<PeripheralManagerDelegate> { // PeripheralManager *peripheralmanager; } - (IBAction)SoundButton:(id)sender; - (IBAction)BatteryButton:(id)sender; @end SVC.m #import \"MeBleSecondViewController.h\" @interface MeBleSecondViewController () { } @end @implementation MeBleSecondViewController{ PeripheralManager *peripheralManager; } - (void)viewDidLoad { [super viewDidLoad]; peripheralManager=[[PeripheralManager alloc]init]; peripheralManager.delegate=self; } #pragma mark - PeripheralManagerDelegate methods - (void)peripheralManagerDidConnectPeripheral:(PeripheralManager *)manager { } - (void)peripheralManagerDidDisconnectPeripheral:(PeripheralManager *)manager { self.label.text = @\"name\"; } - (void)peripheralManagerNotifyAlertReady:(PeripheralManager *)manager { self.alertButton.enabled = YES; } - (void)peripheralManagerCheckBatteryReady:(PeripheralManager *)manager { self.batteryButton.enabled = YES; } - (void)peripheralManager:(PeripheralManager *)manager didCheckBattery:(ushort)value { UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@\"Batter Power\" message:[NSString stringWithFormat:@\"Battery power is ー%d%%\", value] delegate:nil cancelButtonTitle:nil otherButtonTitles:@\"OK\", nil]; [alert1 show]; } #pragma mark - Handlers - (IBAction)SoundButton:(id)sender { [peripheralManager notifyAlert]; } - (IBAction)BatteryButton:(id)sender; { [peripheralManager checkBattery]; } @end
Code Language
clike
java
css
html
javascript
lua
mysql
ometa
perl
php
plsql
python
regex
ruby
rails
scheme
text
xquery
Author *
Are you human?
Private
Save
Pasite Stats
Pasite Size: 2.07 KiB
Total Views: 62
Total Revisions (1)
Rev: 1 - 09:57pm 2012/12/13 - code - 2.07 KiB
Hide Menu