AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/addons/azure_iot/azure-sdk-for-c/sdk/samples/iot/pnp/pnp_protocol.c
static void visit_component_properties(
    az_span component_name,
    az_json_reader* jr,
    int32_t version,
    pnp_property_callback property_callback,
    void* context_ptr)
{
  char const* const log = "Failed to process device twin message";

  while (az_result_succeeded(az_json_reader_next_token(jr)))
  {
    if (jr->token.kind == AZ_JSON_TOKEN_PROPERTY_NAME)
    {
      if (az_json_token_is_text_equal(&(jr->token), component_specifier_name)
          || az_json_token_is_text_equal(&(jr->token), iot_hub_twin_desired_version))
      {
        IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_next_token(jr), log);
        continue;
      }

      // Found a property.
      az_json_token property_name = jr->token;
      IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_next_token(jr), log);

      property_callback(component_name, &property_name, *jr, version, context_ptr);
    }
    else if (jr->token.kind == AZ_JSON_TOKEN_BEGIN_OBJECT)
    {
      IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_skip_children(jr), log);
    }
    else if (jr->token.kind == AZ_JSON_TOKEN_END_OBJECT)
    {
      break;
    }
  }
}
// Visit each valid property for the component
Visit each valid property for the component
Visit each valid property for the component
static void visit_component_properties(
    az_span component_name,
    az_json_reader* jr,
    int32_t version,
    pnp_property_callback property_callback,
    void* context_ptr)
{
  char const* const log = "Failed to process device twin message";
  while (az_result_succeeded(az_json_reader_next_token(jr)))
  {
    if (jr->token.kind == AZ_JSON_TOKEN_PROPERTY_NAME)
    {
      if (az_json_token_is_text_equal(&(jr->token), component_specifier_name)
          || az_json_token_is_text_equal(&(jr->token), iot_hub_twin_desired_version))
      {
        IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_next_token(jr), log);
        continue;
      }
      az_json_token property_name = jr->token;
      IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_next_token(jr), log);
      property_callback(component_name, &property_name, *jr, version, context_ptr);
    }
    else if (jr->token.kind == AZ_JSON_TOKEN_BEGIN_OBJECT)
    {
      IOT_SAMPLE_EXIT_IF_AZ_FAILED(az_json_reader_skip_children(jr), log);
    }
    else if (jr->token.kind == AZ_JSON_TOKEN_END_OBJECT)
    {
      break;
    }
  }
}
static void visit_component_properties ( az_span component_name , az_json_reader * jr , int32_t version , pnp_property_callback property_callback , void * context_ptr ) { char const * const log = " " ; while ( az_result_succeeded ( az_json_reader_next_token ( jr ) ) ) { if ( jr -> token . kind == AZ_JSON_TOKEN_PROPERTY_NAME ) { if ( az_json_token_is_text_equal ( & ( jr -> token ) , component_specifier_name ) || az_json_token_is_text_equal ( & ( jr -> token ) , iot_hub_twin_desired_version ) ) { IOT_SAMPLE_EXIT_IF_AZ_FAILED ( az_json_reader_next_token ( jr ) , log ) ; continue ; } az_json_token property_name = jr -> token ; IOT_SAMPLE_EXIT_IF_AZ_FAILED ( az_json_reader_next_token ( jr ) , log ) ; property_callback ( component_name , & property_name , * jr , version , context_ptr ) ; } else if ( jr -> token . kind == AZ_JSON_TOKEN_BEGIN_OBJECT ) { IOT_SAMPLE_EXIT_IF_AZ_FAILED ( az_json_reader_skip_children ( jr ) , log ) ; } else if ( jr -> token . kind == AZ_JSON_TOKEN_END_OBJECT ) { break ; } } }
Visit each valid property for the component
Visit each valid property for the component
// Found a property.