CloudPebble emulator vs iOS pebble native app?

278 views Asked by At

I want to know how the communication being happened with iOS pebble native app.I can create watch app using cloud pebble but i don't know how establish a connection between cloud simulator and iOS pebble native.

Any help link or any thing would be appreciated.Thanks

3

There are 3 answers

2
dustinroepsch On

If I'm understanding you correctly, you're trying to get your code to compile and execute on your physical pebble watch, correct?

If so, then cloud pebble makes this really easy. Make sure you are signed into the same pebble account in pebble cloud as you are in the pebble app on your phone. It would also be wise to make sure your phone had an internet connection. Afterwords open your application project in cloudpebble, click on the compilation tab, and then click on "phone".

Now open the pebble app for your phone and got to the "Developer Connection" screen, and make sure that it is enabled.

If everything is setup correctly, now when you "Install and Run" from cloudpebble, the application will automatically download to your phone and be pushed onto your watch.

0
Kirby Kohlmorgen On

You just need to enable the developer connection on your iOS app.

You can find it here. https://i.stack.imgur.com/vGFuh.png

0
karthikeyan On

Finally i found it my self.thanks to @dustin @kirby

By default pebble iOS application dont have option to enable developer option mode To enble option ,you need to connect your pebble watch with pebble iOS application using bluetooth.

once you enbled,the pebble iOS application will listen your pebble watch installation from cloud pebble.(i am using cloud pebble).

There are two ways to enble it.

1.Select your device from compilation tab in cloud pebble. 2.Enter IP address manually(But i think its removed from latest version of pebble sdk).

you should plugin your device with your Mac computer. you should paired your pebble watch with you iPhone device.

If your using c code to create pebble watch (My suggestion use cloud pebble)

If you want to communicate with your iPhone device and pebble watch.

Follow here.

The sample code for:C language

Receiving data from iPhone app to watch:

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "Message received!");
    Tuple *t = dict_read_first(iterator);

  while (t != NULL) {
    // Long lived buffer
        static char s_buffer[64];
        APP_LOG(APP_LOG_LEVEL_INFO, "Message ready to get!");
        snprintf(s_buffer, sizeof(s_buffer), "'%s'", t->value->cstring);
        text_layer_set_text(hello_text_layer, s_buffer);
    // Get next pair, if any
    t = dict_read_next(iterator);
  }
}

Receiving data from watch to iPhone app :

- (IBAction)send:(id)sender {

    [self.watch appMessagesLaunch:^(PBWatch *watch, NSError *error) {
        if (!error) {
            NSLog(@"Successfully launched app.");
        }
        else {
            NSLog(@"Error launching app - Error: %@", error);
        }
    }
     ];
    // Register to receive events
    [[PBPebbleCentral defaultCentral] setDelegate:self];
    // Set UUID
//UUID is must which is available in watch application.
        uuid_t myAppUUIDbytes;
        NSUUID *myAppUUID = [[NSUUID alloc] initWithUUIDString:@"3c74cf8f-74e5-4975-8ad5-e4b25beea86f"];
          [myAppUUID getUUIDBytes:myAppUUIDbytes];
        [[PBPebbleCentral defaultCentral] setAppUUID:[NSData dataWithBytes:myAppUUIDbytes length:16]];

    NSDictionary *message = @{@(0):@"optisol",
                              };
    NSLog(@"%@",message);

//sending code
    [self.watch appMessagesPushUpdate:message onSent:^(PBWatch *watch, NSDictionary *update, NSError *error) {
        NSLog(@"getting called");
        if (!error) {
            NSLog(@"Message sent!!!!!!!!");
        }
        else
        {
            NSLog(@"Message not sent!!!!!!!!\n\n%@",error.localizedDescription);

        }


    }];
    //receving code
    [self.watch appMessagesAddReceiveUpdateHandler:^BOOL(PBWatch *watch, NSDictionary *update) {
        // Process incoming messages
        NSLog(@"%@",update);
        NSLog(@"received called");

        return YES;
    }];
}

Should be: 1.Mobile device and computer should be same network 2.Should be paired 3.optional(i am using chrome browser and firefox).

you can download sample project..

Source

To enble developer connection:

Here

To writing Mobile App:

Here

If you have problem with this just restart all devices and try again.