コード例 #1
0
  @SmallTest
  public void
      testReceiveDataWithMSG_VERSION_PEBBLEAndVersionGreaterOrEqualThanCurrentDoesNotSendMessage()
          throws InterruptedException {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addInt32(Constants.MSG_VERSION_PEBBLE, Constants.LAST_VERSION_PEBBLE);

    _pebbleDataReceiver.receiveData(_mockContext, 12345, dic);

    verify(_mockMessageManager, timeout(1000).times(0)).sendMessageToPebble(any(String.class));
  }
コード例 #2
0
ファイル: Pebble.java プロジェクト: skylarbpayne/Pebble12
  /**
   * Sends an event to the app, and tells whether it's been added or removed
   *
   * @param e
   * @param added
   */
  public void sendEvent(Event e, boolean added) {
    byte b_false = 0;
    byte b_true = 1;
    PebbleDictionary data = new PebbleDictionary();
    //		data.addInt32(0,e.hashCode); //The batch number of this transaction
    data.addInt8(1, added ? b_true : b_false); // I have no idea what I'm doing
    data.addInt32(2, e.startDay);
    data.addInt32(3, e.endDay);
    data.addInt32(4, e.startTime);
    data.addInt32(5, e.endTime);
    data.addString(6, e.title);
    pending_events.put(COUNTER, data);
    Log.i(MainActivity.TAG, "start time:" + e.startTime);
    Log.i(MainActivity.TAG, "start day:" + e.startDay);

    pending_events.put(COUNTER, data);
    PebbleKit.sendDataToPebbleWithTransactionId(
        ctx, PEBBLE_APP_UUID, data, COUNTER); // counter is also transaction ID
    COUNTER++;
  }