journal:201403
This is an old revision of the document!
Table of Contents
cam350 merge
이슈
- origin 바뀌는 문제 → eaglecam 바꿔서 해결. altium은 그냥 잘됨
- explode all → 이거 하기는 하는데 뭐하는건지 모르겠네.
- layer 이름 정리 → eaglecam 에서 만드는 이름과 altium이름이 다름. 정리하긴 했는데 dimension layer 이름은 를 어떻게 할지 …
NRF 518
BLE 모듈 개발
개발환경 다운로드
1. S110-SD-v6 2. mdk 3. sdk 4. nrfg0
BLE OSX App 만들기
상황(Situation): bluetooth 스펙도 잘모르고 Core bluetooth도 써본적이 없고, osx 앱도 만들어 본적이 없다. 대체적으로 모른다. ble 모듈개발을 위해 nordic ble 모듈 펌웨어를 읽은적이 있다.
목적(Task): Core bluetooth에서 discover, connect, and retrieve data 하는 간단한 Bluetooth4.0 어플리케이션 만들기
한일(Action*):
- 튜토리얼 보고 BLE OSX App을 만들어 본다
결과(Result):
- 1번 Action에 대한 결과:
배운점(Reflection)
튜토리얼:
// // BPAppDelegate.m // BLEPeripheral // // Created by Sandeep Mistry on 10/28/2013. // Copyright (c) 2013 Sandeep Mistry. All rights reserved. // #import <objc/runtime.h> #import <objc/message.h> #import "BPAppDelegate.h" @interface CBXpcConnection : NSObject //{ // <CBXpcConnectionDelegate> *_delegate; // NSRecursiveLock *_delegateLock; // NSMutableDictionary *_options; // NSObject<OS_dispatch_queue> *_queue; // int _type; // NSObject<OS_xpc_object> *_xpcConnection; // NSObject<OS_dispatch_semaphore> *_xpcSendBarrier; //} // //@property <CBXpcConnectionDelegate> * delegate; - (id)allocXpcArrayWithNSArray:(id)arg1; - (id)allocXpcDictionaryWithNSDictionary:(id)arg1; - (id)allocXpcMsg:(int)arg1 args:(id)arg2; - (id)allocXpcObjectWithNSObject:(id)arg1; - (void)checkIn; - (void)checkOut; - (void)dealloc; - (id)delegate; - (void)disconnect; - (void)handleConnectionEvent:(id)arg1; - (void)handleInvalid; - (void)handleMsg:(int)arg1 args:(id)arg2; - (void)handleReset; - (id)initWithDelegate:(id)arg1 queue:(id)arg2 options:(id)arg3 sessionType:(int)arg4; - (BOOL)isMainQueue; - (id)nsArrayWithXpcArray:(id)arg1; - (id)nsDictionaryFromXpcDictionary:(id)arg1; - (id)nsObjectWithXpcObject:(id)arg1; - (void)sendAsyncMsg:(int)arg1 args:(id)arg2; - (void)sendMsg:(int)arg1 args:(id)arg2; - (id)sendSyncMsg:(int)arg1 args:(id)arg2; - (void)setDelegate:(id)arg1; @end @implementation CBXpcConnection (Swizzled) - (void)sendMsg1:(int)arg1 args:(id)arg2 { NSLog(@"sendMsg: %d, %@", arg1, arg2); if ([self respondsToSelector:@selector(sendMsg1:args:)]) { [self sendMsg1:arg1 args:arg2]; } } - (void)handleMsg1:(int)arg1 args:(id)arg2 { NSLog(@"handleMsg: %d, %@", arg1, arg2); if ([self respondsToSelector:@selector(handleMsg1:args:)]) { [self handleMsg1:arg1 args:arg2]; } } @end @interface BPAppDelegate () @property (nonatomic, strong) CBPeripheralManager *peripheralManager; @property (nonatomic, strong) CBMutableService *service; @end @implementation BPAppDelegate //#define XPC_SPY 1 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { #ifdef XPC_SPY // Insert code here to initialize your application Class xpcConnectionClass = NSClassFromString(@"CBXpcConnection"); Method origSendMethod = class_getInstanceMethod(xpcConnectionClass, @selector(sendMsg:args:)); Method newSendMethod = class_getInstanceMethod(xpcConnectionClass, @selector(sendMsg1:args:)); method_exchangeImplementations(origSendMethod, newSendMethod); Method origHandleMethod = class_getInstanceMethod(xpcConnectionClass, @selector(handleMsg:args:)); Method newHandleMethod = class_getInstanceMethod(xpcConnectionClass, @selector(handleMsg1:args:)); method_exchangeImplementations(origHandleMethod, newHandleMethod); #endif self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil]; } - (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral { NSLog(@"peripheralManagerDidUpdateState: %d", (int)peripheral.state); if (CBPeripheralManagerStatePoweredOn == peripheral.state) { NSData *zombie = [@"zombie" dataUsingEncoding:NSUTF8StringEncoding]; CBMutableCharacteristic *characteristic = [[CBMutableCharacteristic alloc] initWithType:[CBUUID UUIDWithString:@"DDCA9B49-A6F5-462F-A89A-C2144083CA7F"] properties:CBCharacteristicPropertyRead value:zombie permissions:CBAttributePermissionsReadable]; self.service = [[CBMutableService alloc] initWithType:[CBUUID UUIDWithString:@"BD0F6577-4A38-4D71-AF1B-4E8F57708080"] primary:YES]; self.service.characteristics = @[characteristic]; [self.peripheralManager addService:self.service]; } else { [peripheral stopAdvertising]; [peripheral removeAllServices]; } } - (void)peripheralManagerDidStartAdvertising:(CBPeripheralManager *)peripheral error:(NSError *)error { NSLog(@"peripheralManagerDidStartAdvertising: %@", error); } - (void)peripheralManager:(CBPeripheralManager *)peripheral didAddService:(CBService *)service error:(NSError *)error { NSLog(@"peripheralManagerDidAddService: %@ %@", service, error); [peripheral startAdvertising:@{ CBAdvertisementDataLocalNameKey: @"hello" }]; } @end
journal/201403.1394500555.txt.gz · Last modified: 2018/07/18 14:09 (external edit)