Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- interpret XPC messages

  • Loading branch information...
commit 3605a7d9970a83f2e82b4f23731b64cdece8a9c8 1 parent 726691f
@sandeepmistry authored
Showing with 50 additions and 2 deletions.
  1. +50 −2 Estimote Editor/CBXpcConnection+Swizzled.m
View
52 Estimote Editor/CBXpcConnection+Swizzled.m
@@ -27,14 +27,62 @@ + (void)load
- (void)handleMsgSwizzled:(int)arg1 args:(id)arg2
{
- NSLog(@"handleMsg: %d, %@", arg1, arg2);
+ int msgId = arg1;
+ NSDictionary *args = arg2;
+
+ NSString *deviceUUID = [[args objectForKey:@"kCBMsgArgDeviceUUID"] UUIDString];
+
+ if (msgId == 4) {
+ NSLog(@"state change: %@", [args objectForKey:@"kCBMsgArgState"]);
+
+ } else if (msgId == 34) {
+ NSDictionary *advertisementData = [args objectForKey:@"kCBMsgArgAdvertisementData"];
+
+ NSLog(@"device discovered: %@, name = %@", deviceUUID, [advertisementData objectForKey:@"kCBAdvDataLocalName"]);
+
+ } else if (msgId == 35) {
+ NSLog(@"device connected: %@", deviceUUID);
+ } else if (msgId == 51) {
+ NSLog(@"device services discovered: %@", deviceUUID);
+ } else if (msgId == 59) {
+ NSLog(@"device service characteristics discovered: %@", deviceUUID);
+ } else if (msgId == 65) {
+ NSLog(@"device characteristic read: %@, handle = %@, value = %@", deviceUUID, [args objectForKey:@"kCBMsgArgCharacteristicHandle"], [args objectForKey:@"kCBMsgArgData"]);
+ } else if (msgId == 66) {
+ NSLog(@"device characteristic written: %@, handle = %@", deviceUUID, [args objectForKey:@"kCBMsgArgCharacteristicHandle"]);
+ } else {
+ NSLog(@"handleMsg: %d, %@", arg1, arg2);
+ }
[self handleMsgSwizzled:arg1 args:arg2];
}
- (void)sendMsgSwizzled:(int)arg1 args:(id)arg2
{
- NSLog(@"sendMsg: %d, %@", arg1, arg2);
+ int msgId = arg1;
+ NSDictionary *args = arg2;
+
+ NSString *deviceUUID = [[args objectForKey:@"kCBMsgArgDeviceUUID"] UUIDString];
+
+ if (msgId == 1) {
+ NSLog(@"XPC connection init");
+ } else if (msgId == 28){
+ NSLog(@"start scanning");
+ } else if (msgId == 29){
+ NSLog(@"stop scanning");
+ } else if (msgId == 30){
+ NSLog(@"connect: %@", deviceUUID);
+ } else if (msgId == 41){
+ NSLog(@"discover services: %@", deviceUUID);
+ } else if (msgId == 57){
+ NSLog(@"discover service characteristics: %@", deviceUUID);
+ } else if (msgId == 60){
+ NSLog(@"device read characteristic: %@, handle %@", deviceUUID, [args objectForKey:@"kCBMsgArgCharacteristicHandle"]);
+ } else if (msgId == 61){
+ NSLog(@"device write characteristic: %@, handle %@, value = %@", deviceUUID, [args objectForKey:@"kCBMsgArgCharacteristicHandle"], [args objectForKey:@"kCBMsgArgData"]);
+ } else {
+ NSLog(@"sendMsg: %d, %@", arg1, arg2);
+ }
[self sendMsgSwizzled:arg1 args:arg2];
}
Please sign in to comment.
Something went wrong with that request. Please try again.