# Class WearableNode

java.lang.Object
com.codename1.wearable.WearableNode

public class WearableNode extends Object

A device on the other end of the link: the watch as seen from the phone, or the phone as seen from the watch.

Apple pairs a phone with exactly one watch at a time, so there is at most one node there. Wear OS allows several watches paired to one phone, so a phone app can see more than one -- send to all of them unless you have a reason to pick.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WearableNode(String id, String displayName, boolean nearby)`
  Creates a node description.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getDisplayName()`
  Returns the device name a person would recognize, suitable for showing in a UI.
  `String`
  `getId()`
  Returns the platform's opaque identifier for this device, stable for as long as the pairing lasts.
  `boolean`
  `isNearby()`
  Returns true when the device is directly connected (Bluetooth or the same network) rather than merely reachable through the cloud.
  `String`
  `toString()`
  Returns a string representation of the object.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### WearableNode

    public WearableNode(String id, String displayName, boolean nearby)

    Creates a node description. Called by the platform ports; application code obtains nodes from `WearableConnection.getConnectedNodes()`.

    ###### Parameters

    - `id`: the platform's opaque identifier for the device
    - `displayName`: the device name a person would recognize
    - `nearby`: true when the device is directly connected rather than reachable over the cloud

- ## Method Details

  - ### getId

    public String getId()

    Returns the platform's opaque identifier for this device, stable for as long as the pairing lasts.

    ###### Returns

    the node id

  - ### getDisplayName

    public String getDisplayName()

    Returns the device name a person would recognize, suitable for showing in a UI.

    ###### Returns

    the display name

  - ### isNearby

    public boolean isNearby()

    Returns true when the device is directly connected (Bluetooth or the same network) rather than merely reachable through the cloud.

    Informational, not a delivery rule. A cloud-routed peer still receives messages, requests and replicated data -- it appears in the connected set, which is what "connected" means -- so `WearableConnection.isReachable()` and message delivery do not consult this. Expect higher latency, and an actual failure is reported through the send's own error path rather than predicted from the transport.

    ###### Returns

    true if the node is directly connected

  - ### toString

    public String toString()
    Description copied from class: `Object`
    Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
    Overrides:
      `toString` in class `Object`