Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit a90ea6b

Browse files
authored
Merge pull request #1073 from microsoft/pre-release
Merge branch "pre-release" to release
2 parents 7ab7e3c + b6b6ed9 commit a90ea6b

22 files changed

Lines changed: 153 additions & 19 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
#include "mbed.h"
5+
#include "SystemDns.h"
6+
#include "lwip/err.h"
7+
#include "lwip/ip_addr.h"
8+
#include "lwip/dns.h"
9+
10+
int SystemDnsLocalRemoveHost(const char *hostname, const char *addr)
11+
{
12+
ip_addr_t *address = new ip_addr_t;
13+
ip4_addr_set_u32(address, ipaddr_addr(addr));
14+
return dns_local_removehost(hostname, address);
15+
}
16+
17+
int SystemDnsLocalAddHost(const char *hostname, const char *addr)
18+
{
19+
ip_addr_t *address = new ip_addr_t;
20+
ip4_addr_set_u32(address, ipaddr_addr(addr));
21+
return dns_local_addhost(hostname, address);
22+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
#ifndef __SYSTEM_DNS_H__
5+
#define __SYSTEM_DNS_H__
6+
7+
#ifdef __cplusplus
8+
extern "C"
9+
{
10+
#endif // __cplusplus
11+
12+
/*
13+
* @brief Remove all entries from the local host-list for a specific hostname and/or IP addess.
14+
*
15+
* @param hostname hostname for which entries shall be removed from the local host-list.
16+
* addr address for which entries shall be removed from the local host-list.
17+
*
18+
* @return the number of removed entries.
19+
*/
20+
int SystemDnsLocalRemoveHost(const char *hostname, const char *addr);
21+
22+
/*
23+
* @brief Add a hostname/IP address pair to the local host-list. Duplicates are not checked.
24+
*
25+
* @param hostname hostname of the new entry.
26+
* addr IP address of the new entry.
27+
*
28+
* @return Return 0 on success, otherwise return -1.
29+
*/
30+
int SystemDnsLocalAddHost(const char *hostname, const char *addr);
31+
32+
#ifdef __cplusplus
33+
}
34+
#endif // __cplusplus
35+
36+
#endif // __SYSTEM_DNS_H__

AZ3166/src/cores/arduino/system/SystemVersion.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#ifndef __VERSION_H__
66
#define __VERSION_H__
77

8-
#define DEVKIT_MAJOR_VERSION 1
9-
#define DEVKIT_MINOR_VERSION 6
10-
#define DEVKIT_PATCH_VERSION 5
8+
#define DEVKIT_MAJOR_VERSION 2
9+
#define DEVKIT_MINOR_VERSION 0
10+
#define DEVKIT_PATCH_VERSION 0
1111
#define DEVKIT_SDK_VERSION (DEVKIT_MAJOR_VERSION * 10000 + DEVKIT_MINOR_VERSION * 100 + DEVKIT_PATCH_VERSION)
1212

1313
#ifdef __cplusplus

AZ3166/src/libraries/AzureIoT/src/DevKitMQTTClient.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void DevKitMQTTClient_Event_AddProp(EVENT_INSTANCE *message, const char *key, co
463463
Map_AddOrUpdate(propMap, key, value);
464464
}
465465

466-
bool DevKitMQTTClient_Init(bool hasDeviceTwin, bool traceOn)
466+
bool DevKitMQTTClient_Init(bool hasDeviceTwin, bool traceOn, const char * modelId)
467467
{
468468
if (iotHubClientHandle != NULL)
469469
{
@@ -527,6 +527,16 @@ bool DevKitMQTTClient_Init(bool hasDeviceTwin, bool traceOn)
527527
int keepalive = MQTT_KEEPALIVE_INTERVAL_S;
528528
IoTHubClient_LL_SetOption(iotHubClientHandle, "keepalive", &keepalive);
529529
IoTHubClient_LL_SetOption(iotHubClientHandle, "logtrace", &traceOn);
530+
531+
// Sets the name of ModelId for PnP device.
532+
if (modelId != NULL) {
533+
if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_MODEL_ID, modelId) != IOTHUB_CLIENT_OK)
534+
{
535+
LogError("Failed to set option \"model_id\"");
536+
return false;
537+
}
538+
}
539+
530540
if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, trustedCerts) != IOTHUB_CLIENT_OK)
531541
{
532542
LogError("Failed to set option \"TrustedCerts\"");

AZ3166/src/libraries/AzureIoT/src/DevKitMQTTClient.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C"
1212
#endif
1313

1414
#define OPTION_MINI_SOLUTION_NAME "MiniSolution"
15+
#define OPTION_MODEL_ID "model_id"
1516

1617
enum EVENT_TYPE
1718
{
@@ -49,10 +50,11 @@ void DevKitMQTTClient_Event_AddProp(EVENT_INSTANCE *message, const char * key, c
4950
* The connection string is load from the EEPROM.
5051
* @param hasDeviceTwin Enable / disable device twin, default is disable.
5152
* @param traceOn Enable / disable IoT Hub trace, default is disable.
53+
* @param modelId Sets the name of ModelId for PnP device. Null means disable, default is NULL.
5254
*
5355
* @return Return true if initialize successfully, or false if fails.
5456
*/
55-
bool DevKitMQTTClient_Init(bool hasDeviceTwin = false, bool traceOn = false);
57+
bool DevKitMQTTClient_Init(bool hasDeviceTwin = false, bool traceOn = false, const char * modelId = NULL);
5658

5759
/**
5860
* @brief This API sets a runtime option identified by parameter @p optionName

AZ3166/src/system/az3166-driver/mico/net/LwIP/lwip-sys/lwipopts.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ typedef struct
328328
* LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
329329
* transport.
330330
*/
331-
#define LWIP_DNS (1)
331+
#define LWIP_DNS 1
332+
#define DNS_LOCAL_HOSTLIST 1
333+
#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 1
332334

333335

334336
#ifdef LWIP_SO_RCVBUF

AZ3166/src/system/az3166-driver/mico/net/LwIP/lwip-ver1.4.0.rc1/src/include/lwip/dns.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636

3737
#include "lwip/opt.h"
3838

39+
#ifdef __cplusplus
40+
extern "C"
41+
{
42+
#else
43+
#endif
44+
3945
#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
4046

4147
/** DNS timer period */
@@ -113,4 +119,8 @@ err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
113119

114120
#endif /* LWIP_DNS */
115121

122+
#ifdef __cplusplus
123+
}
124+
#endif
125+
116126
#endif /* __LWIP_DNS_H__ */

AZ3166/src/system/az3166-driver/mico/net/LwIP/lwip-ver1.4.0.rc1/src/include/lwip/opt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@
788788
* transport.
789789
*/
790790
#ifndef LWIP_DNS
791-
#define LWIP_DNS 0
791+
#define LWIP_DNS 1
792792
#endif
793793

794794
/** DNS maximum number of entries to maintain locally. */
@@ -827,13 +827,13 @@
827827
* that returns the IP address or INADDR_NONE if not found.
828828
*/
829829
#ifndef DNS_LOCAL_HOSTLIST
830-
#define DNS_LOCAL_HOSTLIST 0
830+
#define DNS_LOCAL_HOSTLIST 1
831831
#endif /* DNS_LOCAL_HOSTLIST */
832832

833833
/** If this is turned on, the local host-list can be dynamically changed
834834
* at runtime. */
835835
#ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC
836-
#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
836+
#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 1
837837
#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
838838

839839
/*

AZ3166/src/system/azure-iot-sdk-c/iothub_client/inc/internal/iothub_client_retry_control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extern "C"
1919

2020
static STATIC_VAR_UNUSED const char* RETRY_CONTROL_OPTION_INITIAL_WAIT_TIME_IN_SECS = "initial_wait_time_in_secs";
2121
static STATIC_VAR_UNUSED const char* RETRY_CONTROL_OPTION_MAX_JITTER_PERCENT = "max_jitter_percent";
22+
static STATIC_VAR_UNUSED const char* RETRY_CONTROL_OPTION_MAX_DELAY_IN_SECS = "max_delay_in_secs";
2223
static STATIC_VAR_UNUSED const char* RETRY_CONTROL_OPTION_SAVED_OPTIONS = "retry_control_saved_options";
2324

2425
typedef enum RETRY_ACTION_TAG

AZ3166/src/system/azure-iot-sdk-c/iothub_client/inc/internal/iothub_internal_consts.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ extern "C"
99
{
1010
#endif
1111

12-
static const char* IOTHUB_API_VERSION = "2017-11-08-preview";
12+
static const char* IOTHUB_API_VERSION = "2019-10-01";
13+
// TODO: https://github.com/Azure/azure-iot-sdk-c/issues/1547 tracks removing this preview
14+
// variable once the underlying logic is enabled on all IoTHubs.
15+
static const char* IOTHUB_API_PREVIEW_VERSION = "2020-05-31-preview";
1316

1417
static const char* SECURITY_INTERFACE_INTERNAL_ID = "iothub-interface-internal-id";
1518
static const char* SECURITY_INTERFACE_INTERNAL_ID_VALUE = "security*azureiot*com^SecurityAgent^1*0*0";

0 commit comments

Comments
 (0)