当前位置: 首页>>代码示例>>Java>>正文


Java PebbleKit.sendDataToPebbleWithTransactionId方法代码示例

本文整理汇总了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;
}
 
开发者ID:matejdro,项目名称:PebbleAndroidCommons,代码行数:13,代码来源:PebbleCommunication.java

示例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);
}
 
开发者ID:matejdro,项目名称:PebbleAndroidCommons,代码行数:12,代码来源:PebbleCommunication.java

示例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;
}
 
开发者ID:JanBobolz,项目名称:agendawatchfaceAndroid,代码行数:21,代码来源:AgendaWatchfaceService.java

示例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");
}
 
开发者ID:etiago,项目名称:WeChatPebble,代码行数:10,代码来源:MainActivity.java

示例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++;
}
 
开发者ID:mcongrove,项目名称:TitaniumPebble,代码行数:51,代码来源:TitaniumPebbleModule.java


注:本文中的com.getpebble.android.kit.PebbleKit.sendDataToPebbleWithTransactionId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。