本文整理汇总了Java中com.getpebble.android.kit.PebbleKit.sendDataToPebbleWithTransactionId方法的典型用法代码示例。如果您正苦于以下问题:Java PebbleKit.sendDataToPebbleWithTransactionId方法的具体用法?Java PebbleKit.sendDataToPebbleWithTransactionId怎么用?Java PebbleKit.sendDataToPebbleWithTransactionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.getpebble.android.kit.PebbleKit
的用法示例。
在下文中一共展示了PebbleKit.sendDataToPebbleWithTransactionId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendToPebble
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void sendToPebble(PebbleDictionary packet)
{
lastSentPacket = (lastSentPacket + 1) % 255;
Timber.d("SENT %d", lastSentPacket);
this.lastPacket = packet;
PebbleKit.sendDataToPebbleWithTransactionId(talkerService, PebbleCompanionApplication.fromContext(talkerService).getPebbleAppUUID(), packet, lastSentPacket);
commBusy = true;
retryCount = 0;
}
示例2: run
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Override
public void run()
{
if (lastPacket == null)
return;
lastSentPacket = (lastSentPacket + 1) % 255;
Timber.d("SENT %d", lastSentPacket);
PebbleKit.sendDataToPebbleWithTransactionId(talkerService, PebbleCompanionApplication.fromContext(talkerService).getPebbleAppUUID(), lastPacket, lastSentPacket);
}
示例3: sendMessage
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* Sends data to the watch. Only resends once
*
* @param resend
* whether or not this message has been sent already at some point
* @return true iff message was sent. false if retries have been exhausted.
*/
private synchronized boolean sendMessage(PebbleDictionary data, boolean resend) {
transactionFlying = (transactionFlying + 1) % 256; // new transaction
if ((numRetries = resend ? numRetries + 1 : 0) > 2) {
Log.d("PebbleCommunication", "Stopped retrying message sending in state " + state);
return false;
}
if (resend)
Log.d("PebbleCommunication", "Resending message. This is retry number "+(numRetries));
lastSentDict = data;
PebbleKit.sendDataToPebbleWithTransactionId(getApplicationContext(), PEBBLE_APP_UUID, data, transactionFlying);
return true;
}
示例4: btnRefreshClick
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void btnRefreshClick(View v) {
PebbleDictionary data = new PebbleDictionary();
//data.addString(PebbleMessage.PBL_MESSAGE, new String(send));
data.addBytes(PebbleMessage.PBL_RESET, new byte[]{'a'});
PebbleKit.sendDataToPebbleWithTransactionId(getApplicationContext(), PebbleMessage.WECHATPEBBLE_UUID, data, 2);
Log.d("Main","Manual refresh");
}
示例5: sendMessage
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Kroll.method
public void sendMessage(HashMap args)
{
Log.d(LCAT, "sendMessage");
if(!checkWatchConnected())
{
Log.w(LCAT, "sendMessage: No watch connected");
return;
}
final KrollFunction successCallback = (KrollFunction)args.get("success");
final KrollFunction errorCallback = (KrollFunction)args.get("error");
final Object message = args.get("message");
Map<Integer, Object> messageHash = (HashMap<Integer, Object>) message;
Iterator<Map.Entry<Integer, Object>> entries = messageHash.entrySet().iterator();
HashMap<String,KrollFunction> callbackArray = new HashMap<String,KrollFunction>();
PebbleDictionary data = new PebbleDictionary();
if(successCallback != null)
{
callbackArray.put("success", successCallback);
}
if(errorCallback != null)
{
callbackArray.put("error", errorCallback);
}
callbacks.put(transactionCounter, callbackArray);
while(entries.hasNext())
{
Map.Entry<Integer, Object> entry = entries.next();
if(entry.getValue() instanceof Integer)
{
data.addInt32((Integer) entry.getKey(), (Integer) entry.getValue());
} else if(entry.getValue() instanceof String) {
data.addString((Integer) entry.getKey(), (String) entry.getValue());
}
}
PebbleKit.sendDataToPebbleWithTransactionId(getApplicationContext(), uuid, data, transactionCounter);
transactionCounter++;
}