@Override public boolean onRequest(final Intent request, final Intent response) { String pattern = getPattern(request); String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_VIBRATION_RUN, convertPatternToString(parsePattern(pattern)), new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { setResult(response, DConnectMessage.RESULT_OK); } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_VIBRATION_DEL, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { setResult(response, DConnectMessage.RESULT_OK); } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHCHANGE_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCH_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHSTART_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHEND_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONDOUBLETAP_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHMOVE_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHCANCEL_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONDOWN_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONUP_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONKEYCHANGE_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); // Event release. EventError error = EventManager.INSTANCE.removeEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } return true; }
@Override protected void onDestroy() { super.onDestroy(); if (connectivity != null) { connectivity.sendMessage(Messages.clearSelected(nodeId), new ResultCallback<SendMessageResult>() { @Override public void onResult(SendMessageResult sendMessageResult) { connectivity.disconnect(); } }); } }
public synchronized void sendMessage(final Message message, final ResultCallback<SendMessageResult> callback) { threadPool.execute(new Runnable() { @Override public void run() { apiClient.blockingConnect(TIMEOUT, TimeUnit.MILLISECONDS); try { PendingResult<SendMessageResult> pendingResult = Wearable.MessageApi.sendMessage(apiClient, message.getNodeId(), message.getPath(), message.getPayload()); if (callback != null) { pendingResult.setResultCallback(callback); } } catch (Exception e) { e.printStackTrace(); } } }); }
public synchronized void sendMessage(final Message message, final ResultCallback<SendMessageResult> callback) { threadPool.execute(new Runnable() { @Override public void run() { apiClient.blockingConnect(TIMEOUT, TimeUnit.MILLISECONDS); try { PendingResult<SendMessageResult> pendingResult = Wearable.MessageApi.sendMessage(apiClient, message.getNodeId(), message.getPath(), message.getPayloadAsBytes()); if (callback != null) { pendingResult.setResultCallback(callback); } } catch (Exception e) { e.printStackTrace(); } } }); }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_DEIVCEORIENTATION_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
/** * 指定されたWearのセンサーを停止する. * @param nodeId wearのID */ private void stopSensor(final String nodeId) { getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_DEIVCEORIENTATION_UNREGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { } @Override public void onError() { } }); }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHCHANGE_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCH_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHSTART_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHEND_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONDOUBLETAP_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHMOVE_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_TOUCH_ONTOUCHCANCEL_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { // Event registration. EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONDOWN_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONUP_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
@Override public boolean onRequest(final Intent request, final Intent response) { String nodeId = WearUtils.getNodeId(getServiceID(request)); getManager().sendMessageToWear(nodeId, WearConst.DEVICE_TO_WEAR_KEYEVENT_ONKEYCHANGE_REGISTER, "", new OnMessageResultListener() { @Override public void onResult(final SendMessageResult result) { if (result.getStatus().isSuccess()) { EventError error = EventManager.INSTANCE.addEvent(request); if (error == EventError.NONE) { setResult(response, DConnectMessage.RESULT_OK); } else { setResult(response, DConnectMessage.RESULT_ERROR); } } else { MessageUtils.setIllegalDeviceStateError(response); } sendResponse(response); } @Override public void onError() { MessageUtils.setIllegalDeviceStateError(response); sendResponse(response); } }); return false; }
public void run() { NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(mApiClient).await(); for(Node node : nodes.getNodes()) { SendMessageResult result = Wearable.MessageApi.sendMessage(mApiClient, node.getId(), path, message.getBytes()).await(); if(result.getStatus().isSuccess()) { Log.v("myTag", "Message: {" + message + "} sent to: " + node.getDisplayName()); } else { // Log an error Log.v("myTag", "ERROR: failed to send message"); } } }
private void sendStartActivityMessage(String node) { Wearable.MessageApi.sendMessage( mGoogleApiClient, node, START_ACTIVITY_PATH, new byte[0]).setResultCallback( new ResultCallback<SendMessageResult>() { @Override public void onResult(SendMessageResult sendMessageResult) { if (!sendMessageResult.getStatus().isSuccess()) { Log.e(TAG, "Failed to send message with status code: " + sendMessageResult.getStatus().getStatusCode()); } } } ); }
public zzad(zzmu.zzb<MessageApi.SendMessageResult> paramzzb) { super(); }
public final PendingResult<MessageApi.SendMessageResult> sendMessage(GoogleApiClient paramGoogleApiClient, final String paramString1, final String paramString2, final byte[] paramArrayOfByte) { paramGoogleApiClient.zza(new zzi(paramGoogleApiClient) {}); }
@Override public void onResult(SendMessageResult sendMessageResult) { }