Tabnine Logo
Pair
Code IndexAdd Tabnine to your IDE (free)

How to use
Pair
in
com.microsoft.azure.sdk.iot.device.DeviceTwin

Best Java code snippets using com.microsoft.azure.sdk.iot.device.DeviceTwin.Pair (Showing top 20 results out of 315)

origin: Azure/azure-iot-sdk-java

  @Override
  public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeReason statusChangeReason, Throwable throwable, Object callbackContext)
  {
    actualStatusUpdates.add(new Pair<>(status, throwable));
  }
}, new Object());
origin: Azure/azure-iot-sdk-java

public String getKey()
{
  /*
  **Codes_SRS_Property_25_003: [**The function shall return the value of the key corresponding to this property.**]**
  */
  return this.property.getKey();
}
origin: Azure/azure-iot-sdk-java

public Object getValue()
{
  /*
  **Codes_SRS_Property_25_004: [**The function shall return the value for this property.**]**
   */
  return this.property.getValue();
}
origin: Azure/azure-iot-sdk-java

private boolean reportPropertyCallback(Property property)
{
  boolean reported = false;
  if (onDesiredPropertyChangeMap != null && onDesiredPropertyChangeMap.containsKey(property.getKey()))
  {
    Pair<PropertyCallBack<String, Object>, Object> callBackObjectPair = onDesiredPropertyChangeMap.get(property.getKey());
    if (callBackObjectPair != null && callBackObjectPair.getKey() != null)
    {
      callBackObjectPair.getKey().PropertyCall(property.getKey(), property.getValue(), callBackObjectPair.getValue());
      reported = true;
    }
  }
  if (onDesiredTwinPropertyChangeMap != null && onDesiredTwinPropertyChangeMap.containsKey(property.getKey()))
  {
    Pair<TwinPropertyCallBack, Object> callBackObjectPair = onDesiredTwinPropertyChangeMap.get(property.getKey());
    if (callBackObjectPair != null && callBackObjectPair.getKey() != null)
    {
      callBackObjectPair.getKey().TwinPropertyCallBack(property, callBackObjectPair.getValue());
      reported = true;
    }
  }
  return reported;
}
origin: Azure/azure-iot-sdk-java

public void setValue(Object newValue)
{
  /*
  **Codes_SRS_Property_25_005: [**The function shall overwrite the new value for old.**]**
   */
  this.property.setValue(newValue);
}
origin: Azure/azure-iot-sdk-java

  @Override
  public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeReason statusChangeReason, Throwable throwable, Object callbackContext)
  {
    statusUpdates.add(new Pair<>(status, throwable));
  }
}, new Object());
origin: Azure/azure-iot-sdk-java

  public static boolean actualStatusUpdatesContainsStatus(List<Pair<IotHubConnectionStatus, Throwable>> actualStatusUpdates, IotHubConnectionStatus status)
  {
    for (int i = 0; i < actualStatusUpdates.size(); i++)
    {
      if (actualStatusUpdates.get(i).getKey() == status)
      {
        return true;
      }
    }

    return false;
  }
}
origin: Azure/azure-iot-sdk-java

/**
 * Getter for the context to be passed in to the message callback.
 *
 * @param inputName the inputName that the desired callback context is tied to, or null for the default callback context
 *
 * @return the message context.
 */
public Object getDeviceTelemetryMessageContext(String inputName)
{
  if (inputName == null || !this.inputChannelMessageCallbacks.containsKey(inputName))
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_011: [If the inputName is null, or the message callbacks map does not
    // contain the provided inputName, this function shall return the default message callback context.]
    return this.defaultDeviceTelemetryMessageContext;
  }
  else
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_046: [If the message callbacks map contains the provided inputName, this function
    // shall return the context associated with that inputName.]
    return this.inputChannelMessageCallbacks.get(inputName).getValue();
  }
}
origin: Azure/azure-iot-sdk-java

  @Override
  public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeReason statusChangeReason, Throwable throwable, Object callbackContext)
  {
    connectionStatusUpdates.add(new Pair<>(status, throwable));
  }
}, null);
origin: Azure/azure-iot-sdk-java

/**
 * Getter for the message callback.
 *
 * @param inputName the inputName that the desired callback is tied to, or null for the default callback
 *
 * @return the message callback.
 */
public MessageCallback getDeviceTelemetryMessageCallback(String inputName)
{
  if (inputName == null || !this.inputChannelMessageCallbacks.containsKey(inputName))
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_010: [If the inputName is null, or the message callbacks map does not
    // contain the provided inputName, this function shall return the default message callback.]
    return this.defaultDeviceTelemetryMessageCallback;
  }
  else
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_045: [If the message callbacks map contains the provided inputName, this function
    // shall return the callback associated with that inputName.]
    return this.inputChannelMessageCallbacks.get(inputName).getKey();
  }
}
origin: Azure/azure-iot-sdk-java

  @Override
  public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeReason statusChangeReason, Throwable throwable, Object callbackContext)
  {
    actualStatusUpdates.add(new com.microsoft.azure.sdk.iot.device.DeviceTwin.Pair<>(status, throwable));
  }
};
origin: Azure/azure-iot-sdk-java

public static void confirmOpenStabilized(List<Pair<IotHubConnectionStatus, Throwable>> actualStatusUpdates, long timeout, InternalClient client) throws InterruptedException
{
  long startTime = System.currentTimeMillis();
  long timeElapsed;
  int numOfUpdates = 0;
  if (actualStatusUpdates != null)
  {
    while (numOfUpdates == 0 || numOfUpdates != actualStatusUpdates.size() || actualStatusUpdates.get(actualStatusUpdates.size() - 1).getKey() != IotHubConnectionStatus.CONNECTED)
    {
      numOfUpdates = actualStatusUpdates.size();
      Thread.sleep(6 * 1000);
      timeElapsed = System.currentTimeMillis() - startTime;
      if (timeElapsed > timeout)
      {
        Assert.fail(buildExceptionMessage("Timed out waiting for a stable connection on first open", client));
      }
    }
  }
}
origin: Azure/azure-iot-sdk-java

  @Override
  public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeReason statusChangeReason, Throwable throwable, Object callbackContext)
  {
    actualStatusUpdates.add(new Pair<>(status, throwable));
  }
};
origin: Azure/azure-iot-sdk-java

public void setDesiredPropertyCallback(Property desiredProp, PropertyCallBack<String, Object> desiredPropCallBack, Object desiredPropCallBackContext)
{
  if (desiredProp  == null)
  {
    /*
    **Codes_SRS_DEVICE_25_007: [**If the parameter desiredProp is null then this method shall throw IllegalArgumentException**]**
     */
    throw new IllegalArgumentException("desired property cannot be null");
  }
  /*
  **Codes_SRS_DEVICE_25_006: [**The function shall add the property and its callback and context pair to the user map of desired properties.**]**
  **Codes_SRS_DEVICE_25_008: [**This method shall add the parameters to the map even if callback and object pair are null**]**
   */
  this.desiredProp.put(desiredProp, new Pair<>(desiredPropCallBack, desiredPropCallBackContext));
}
origin: Azure/azure-iot-sdk-java

public void setMessageCallback(String inputName, MessageCallback callback, Object context)
{
  if (this.inputChannelMessageCallbacks.containsKey(inputName) && callback == null)
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_058: [If the provided inputName is already saved in the message callbacks map, and the provided callback is null, this function
    // shall remove the inputName from the message callbacks map.]
    this.inputChannelMessageCallbacks.remove(inputName);
  }
  else
  {
    // Codes_SRS_DEVICECLIENTCONFIG_34_044: [The function shall map the provided inputName to the callback and context in the saved inputChannelMessageCallbacks map.]
    this.inputChannelMessageCallbacks.put(inputName, new Pair<>(callback, context));
  }
}
origin: Azure/azure-iot-sdk-java

public Property(String key, Object value)
{
  if (key == null || key.isEmpty())
  {
    /*
    **Codes_SRS_Property_25_002: [**If the key is null or empty, the constructor shall throw an IllegalArgumentException.**]
     */
    throw new IllegalArgumentException("Key cannot be null or empty");
  }
  if (key.contains(" ") || key.contains("$") || key.contains("."))
  {
    /*
    **Codes_SRS_Property_25_006: [**If the key contains illegal unicode control characters i.e ' ', '.', '$', the constructor shall throw an IllegalArgumentException.**]**
     */
    throw new IllegalArgumentException("Key cannot contain illegal unicode control characters '.', '$', ' '");
  }
  /*
  **Codes_SRS_Property_25_001: [**The constructor shall save the key and value representing this property.**]**
   */
  this.property = new Pair<>(key, value);
}
origin: Azure/azure-iot-sdk-java

@Test
public void testSubscribeToDesiredPropertiesWithVersion() throws IOException, InterruptedException, IotHubException
{
  // arrange
  deviceUnderTest.sCDeviceForTwin.clearTwin();
  deviceUnderTest.dCDeviceForTwin.getDesiredProp().clear();
  Map<Property, Pair<TwinPropertyCallBack, Object>> desiredPropertiesCB = new HashMap<>();
  for (int i = 0; i < MAX_PROPERTIES_TO_TEST; i++)
  {
    PropertyState propertyState = new PropertyState();
    propertyState.callBackTriggered = false;
    propertyState.propertyNewVersion = -1;
    propertyState.property = new Property(PROPERTY_KEY + i, PROPERTY_VALUE);
    deviceUnderTest.dCDeviceForTwin.propertyStateList[i] = propertyState;
    desiredPropertiesCB.put(propertyState.property, new com.microsoft.azure.sdk.iot.device.DeviceTwin.Pair<TwinPropertyCallBack, Object>(deviceUnderTest.dCOnProperty, propertyState));
  }
  // act
  internalClient.subscribeToTwinDesiredProperties(desiredPropertiesCB);
  Thread.sleep(DELAY_BETWEEN_OPERATIONS);
  Set<com.microsoft.azure.sdk.iot.service.devicetwin.Pair> desiredProperties = new HashSet<>();
  for (int i = 0; i < MAX_PROPERTIES_TO_TEST; i++)
  {
    desiredProperties.add(new com.microsoft.azure.sdk.iot.service.devicetwin.Pair(PROPERTY_KEY + i, PROPERTY_VALUE_UPDATE + UUID.randomUUID()));
  }
  deviceUnderTest.sCDeviceForTwin.setDesiredProperties(desiredProperties);
  sCDeviceTwin.updateTwin(deviceUnderTest.sCDeviceForTwin);
  // assert
  waitAndVerifyTwinStatusBecomesSuccess();
  waitAndVerifyDesiredPropertyCallback(PROPERTY_VALUE_UPDATE, true);
}
origin: Azure/azure-iot-sdk-java

propertyState.property = new Property(PROPERTY_KEY + i, PROPERTY_VALUE);
deviceUnderTest.dCDeviceForTwin.propertyStateList[i] = propertyState;
desiredPropertiesCB.put(propertyState.property, new com.microsoft.azure.sdk.iot.device.DeviceTwin.Pair<TwinPropertyCallBack, Object>(deviceUnderTest.dCOnProperty, propertyState));
origin: Azure/azure-iot-sdk-java

put(new Property("HomeTemp(F)", null), new Pair<TwinPropertyCallBack, Object>(new onHomeTempChange(), null));
put(new Property("LivingRoomLights", null), new Pair<TwinPropertyCallBack, Object>(new onProperty(), null));
put(new Property("BedroomRoomLights", null), new Pair<TwinPropertyCallBack, Object>(new onProperty(), null));
put(new Property("HomeSecurityCamera", null), new Pair<TwinPropertyCallBack, Object>(new onCameraActivity(), null));
origin: Azure/azure-iot-sdk-java

put(new Property("HomeTemp(F)", null), new Pair<TwinPropertyCallBack, Object>(new onHomeTempChange(), null));
put(new Property("LivingRoomLights", null), new Pair<TwinPropertyCallBack, Object>(new onProperty(), null));
put(new Property("BedroomRoomLights", null), new Pair<TwinPropertyCallBack, Object>(new onProperty(), null));
put(new Property("HomeSecurityCamera", null), new Pair<TwinPropertyCallBack, Object>(new onCameraActivity(), null));
com.microsoft.azure.sdk.iot.device.DeviceTwinPair

Most used methods

    Popular in Java

    • Parsing JSON documents to java classes using gson
    • onCreateOptionsMenu (Activity)
    • setContentView (Activity)
    • getResourceAsStream (ClassLoader)
    • ObjectMapper (com.fasterxml.jackson.databind)
      ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
    • Pointer (com.sun.jna)
      An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
    • EOFException (java.io)
      Thrown when a program encounters the end of a file or stream during an input operation.
    • FileReader (java.io)
      A specialized Reader that reads from a file in the file system. All read requests made by calling me
    • Locale (java.util)
      Locale represents a language/country/variant combination. Locales are used to alter the presentatio
    • StringTokenizer (java.util)
      Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
    • CodeWhisperer alternatives
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now