Latest 1.2.1
Homepage https://github.com/Kalvar/ios-KRBle
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, CoreBluetooth
Authors

Screen Shot

ScanHome  
Central  

Peripheral

Podfile

platform :ios, '7.0'
pod "KRBle", "~> 1.2.1"

How To Get Started

KRBle implements the Bluetooth Low Engery (BLE) and simulate SPP transfer big data ( ex : image / 2,000 words ), central and peripheral can exchange the big data to each other, summarized, you could easy use this project to build your BLE applications.

#import "BLECentral.h"

- (void)viewDidLoad
{
    [super viewDidLoad];

    __weak typeof(self) _weakSelf = self;

    _bleCentral = [BLECentral sharedInstance];

    //Scanning interval gap holder.
    [_bleCentral setScanIntervalHandler:^CGFloat
    {
        /*
         * @ 設定每 x 秒為 Scanning 的區間範圍
         *   - 每 x 秒進一次 centralManager:didDisconnectPeripheral:error: 的 Delegate
         *   - 每 x 秒才進 foundPeripheralHandler
         *   - <= 0.0f 秒為不限制 ( Default )
         */
        return 0.0f;
    }];

    //Find out peripheral will enter this block
    [_bleCentral setFoundPeripheralHandler:^(CBCentralManager *centralManager, CBPeripheral *peripheral, NSDictionary *advertisementData, NSInteger rssi)
    {
        if( ![_weakSelf.peripherals containsObject:peripheral] )
        {
            [_weakSelf.peripherals addObject:peripheral];
            dispatch_async(dispatch_get_main_queue(), ^{
                [_weakSelf.tableView reloadData];
            });
        }
    }];
}

-(void)scanMethods
{
    /*
     * @ Scan Methods
     */
    //Unlimit scanning, iPhone will be scanning 8 times per 1 sec.
    [_bleCentral startScan];

    //Limits scanning interval, may it can save some power waste.
    [_bleCentral startScanInterval:5.0f continueInterval:10.0f];

    //Scanning before timeout
    [_bleCentral startScanTimeout:2.0f];

    //Scan for limit-services.
    [_bleCentral startScanForServices:@[[CBUUID UUIDWithString:@"FFA0"]]];
}

-(void)stopScan
{
    [_bleCentral stopScan];
}

// More information please see the source code, by the way, I'm living in Taiwan, 
// so the source code remarks almost Chinese language.
// If you have any questions or never know the remarks talking about, 
// just ask me or create an issue to exchange the conversation, I'll so glad to give you a hand.

Version

V1.2.1

License

MIT.

Remarks

Sharing is the best importance in the whole world.

Latest podspec

{
    "name": "KRBle",
    "version": "1.2.1",
    "summary": "Achieved BLE with Central and Peripheral modules in BT4.0.",
    "description": "KRBle implements the Bluetooth Low Engery (BLE) and simulate SPP transfer big data ( ex : image / 2,000 words ), central and peripheral can exchange the big data to each other, summarized, you could easy use this project to build your BLE applications.",
    "homepage": "https://github.com/Kalvar/ios-KRBle",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kalvar Lin": "[email protected]"
    },
    "social_media_url": "https://twitter.com/ilovekalvar",
    "source": {
        "git": "https://github.com/Kalvar/ios-KRBle.git",
        "tag": "1.2.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "public_header_files": "KRBle/**/*.h",
    "source_files": "KRBle/**/*.{h,m}",
    "frameworks": [
        "Foundation",
        "CoreBluetooth"
    ]
}

Pin It on Pinterest

Share This