Skip to content

Commit

Permalink
Removing ENABLE_MODULES_SDK compilation flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Pop committed Jun 19, 2018
1 parent 3b60bc7 commit e544966
Show file tree
Hide file tree
Showing 33 changed files with 18 additions and 169 deletions.
7 changes: 0 additions & 7 deletions common/src/service/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,9 @@ static void ValidateBufferBounds(int bufferSize, int offset, int size)

public static string GetClientVersion()
{
#if NETSTANDARD1_3
// System.Reflection.Assembly.GetExecutingAssembly() does not exist for UWP, therefore use a hard-coded version name
// (This string is picked up by the bump_version script, so don't change the line below)
var UWPAssemblyVersion = "1.16.0-preview-002";
return UWPAssemblyVersion;
#else
var a = Assembly.GetExecutingAssembly();
var attribute = (AssemblyInformationalVersionAttribute)a.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), true)[0];
return a.GetName().Name + "/" + attribute.InformationalVersion;
#endif
}
}
}
1 change: 0 additions & 1 deletion doc/manage_iot_hub.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ For information about using the Device Explorer tool to perform tasks such as di
[lnk-install-iothub-explorer]: https://github.com/Azure/iothub-explorer#installing-iothub-explorer
[lnk-iothub-explorer-identity]: https://github.com/Azure/iothub-explorer#working-with-the-device-identity-registry
[lnk-iothub-explorer-devices]: https://github.com/Azure/iothub-explorer#working-with-devices
[lnk-releasepage]: https://github.com/Azure/azure-iot-sdks-preview/releases
[lnk-device-explorer-docs]: ../tools/DeviceExplorer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0-preview*" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.*" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

Expand Down
13 changes: 0 additions & 13 deletions iothub/device/src/AuthenticationMethodFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ internal static IAuthenticationMethod GetAuthenticationMethod(IotHubConnectionSt
else if (iotHubConnectionStringBuilder.SharedAccessKey != null)
{

#if ENABLE_MODULES_SDK
if(iotHubConnectionStringBuilder.ModuleId != null)
{
return new ModuleAuthenticationWithRegistrySymmetricKey(
Expand All @@ -32,14 +31,9 @@ internal static IAuthenticationMethod GetAuthenticationMethod(IotHubConnectionSt
return new DeviceAuthenticationWithRegistrySymmetricKey(
iotHubConnectionStringBuilder.DeviceId, iotHubConnectionStringBuilder.SharedAccessKey);
}
#else
return new DeviceAuthenticationWithRegistrySymmetricKey(
iotHubConnectionStringBuilder.DeviceId, iotHubConnectionStringBuilder.SharedAccessKey);
#endif
}
else if (iotHubConnectionStringBuilder.SharedAccessSignature != null)
{
#if ENABLE_MODULES_SDK
if(iotHubConnectionStringBuilder.ModuleId != null)
{
return new ModuleAuthenticationWithToken(
Expand All @@ -50,9 +44,6 @@ internal static IAuthenticationMethod GetAuthenticationMethod(IotHubConnectionSt
return new DeviceAuthenticationWithToken(
iotHubConnectionStringBuilder.DeviceId, iotHubConnectionStringBuilder.SharedAccessSignature);
}
#else
return new DeviceAuthenticationWithToken(iotHubConnectionStringBuilder.DeviceId, iotHubConnectionStringBuilder.SharedAccessSignature);
#endif
}
#if !NETMF
else if (iotHubConnectionStringBuilder.UsingX509Cert)
Expand Down Expand Up @@ -91,7 +82,6 @@ public static IAuthenticationMethod CreateAuthenticationWithToken(string deviceI
return new DeviceAuthenticationWithToken(deviceId, token);
}

#if ENABLE_MODULES_SDK
/// <summary>
/// Creates a <see cref="ModuleAuthenticationWithToken"/> instance based on the parameters.
/// </summary>
Expand All @@ -103,7 +93,6 @@ public static IAuthenticationMethod CreateAuthenticationWithToken(string deviceI
{
return new ModuleAuthenticationWithToken(deviceId, moduleId, token);
}
#endif

/// <summary>
/// Creates a <see cref="DeviceAuthenticationWithRegistrySymmetricKey"/> instance based on the parameters.
Expand All @@ -116,7 +105,6 @@ public static IAuthenticationMethod CreateAuthenticationWithRegistrySymmetricKey
return new DeviceAuthenticationWithRegistrySymmetricKey(deviceId, key);
}

#if ENABLE_MODULES_SDK
/// <summary>
/// Creates a <see cref="ModuleAuthenticationWithRegistrySymmetricKey"/> instance based on the parameters.
/// </summary>
Expand All @@ -128,6 +116,5 @@ public static IAuthenticationMethod CreateAuthenticationWithRegistrySymmetricKey
{
return new ModuleAuthenticationWithRegistrySymmetricKey(deviceId, moduleId, key);
}
#endif
}
}
17 changes: 4 additions & 13 deletions iothub/device/src/Common/Api/ClientApiVersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@

namespace Microsoft.Azure.Devices.Client
{
class ClientApiVersionHelper
internal class ClientApiVersionHelper
{
const string ApiVersionQueryPrefix = "api-version=";
const string ApiVersionNov2016 = "2016-11-14";
const string ApiVersionJune2017 = "2017-06-30";

#if ENABLE_MODULES_SDK
const string ApiVersionEdgePublicPreview = "2017-11-08-preview";
const string ApiVersionLatest = ApiVersionEdgePublicPreview;
#else
const string ApiVersionLatest = ApiVersionJune2017;
#endif
internal const string ApiVersionQueryPrefix = "api-version=";
internal const string ApiVersionLatest = "2018-06-30";

public const string ApiVersionString = ApiVersionLatest;

public const string ApiVersionQueryString = ApiVersionQueryPrefix + ApiVersionString;
}
}
}
3 changes: 0 additions & 3 deletions iothub/device/src/DirectMethodRequest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK
namespace Microsoft.Azure.Devices.Client
{
using System;
Expand Down Expand Up @@ -125,5 +124,3 @@ public string GetPayloadAsJson()
internal JRaw Payload { get; set; }
}
}

#endif
4 changes: 0 additions & 4 deletions iothub/device/src/DirectMethodResult.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK

namespace Microsoft.Azure.Devices.Client
{
using Newtonsoft.Json;
Expand Down Expand Up @@ -31,5 +29,3 @@ public string GetPayloadAsJson()
internal JRaw Payload { get; set; }
}
}

#endif
7 changes: 1 addition & 6 deletions iothub/device/src/IotHubConnectionStringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,11 @@ void Parse(string iotHubConnectionString)
// DeviceId
this.DeviceId = WebUtility.UrlDecode(values[1]);
}
#if ENABLE_MODULES_SDK
else if (part.IndexOf("ModuleId") > -1)
{
// ModuleId
this.ModuleId = WebUtility.UrlDecode(values[1]);
}
#endif
else if (part.IndexOf("SharedAccessKeyName") > -1)
{
// Shared Access Key Name
Expand Down Expand Up @@ -279,9 +277,7 @@ void Parse(string iotHubConnectionString)

this.HostName = GetConnectionStringValue(map, HostNamePropertyName);
this.DeviceId = WebUtility.UrlDecode(GetConnectionStringOptionalValue(map, DeviceIdPropertyName));
#if ENABLE_MODULES_SDK
this.ModuleId = WebUtility.UrlDecode(GetConnectionStringOptionalValue(map, ModuleIdPropertyName));
#endif
this.SharedAccessKeyName = GetConnectionStringOptionalValue(map, SharedAccessKeyNamePropertyName);
this.SharedAccessKey = GetConnectionStringOptionalValue(map, SharedAccessKeyPropertyName);
this.SharedAccessSignature = GetConnectionStringOptionalValue(map, SharedAccessSignaturePropertyName);
Expand Down Expand Up @@ -348,12 +344,11 @@ void Validate()

ValidateFormat(this.HostName, HostNamePropertyName, HostNameRegex);
ValidateFormat(this.DeviceId, DeviceIdPropertyName, IdNameRegex);
#if ENABLE_MODULES_SDK
if (!string.IsNullOrEmpty(this.ModuleId))
{
ValidateFormat(this.ModuleId, DeviceIdPropertyName, IdNameRegex);
}
#endif

ValidateFormatIfSpecified(this.SharedAccessKeyName, SharedAccessKeyNamePropertyName, SharedAccessKeyNameRegex);
ValidateFormatIfSpecified(this.SharedAccessKey, SharedAccessKeyPropertyName, SharedAccessKeyRegex);
ValidateFormatIfSpecified(this.SharedAccessSignature, SharedAccessSignaturePropertyName, SharedAccessSignatureRegex);
Expand Down
1 change: 0 additions & 1 deletion iothub/device/src/Microsoft.Azure.Devices.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<PackageProjectUrl>https://github.com/Azure/azure-iot-sdk-csharp</PackageProjectUrl>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>IoT Microsoft Azure IoTHub Device Client .NET AMQP MQTT HTTP</PackageTags>
<DefineConstants>$(DefineConstants);ENABLE_MODULES_SDK</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions iothub/service/src/AmqpServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ sealed class AmqpServiceClient : ServiceClient
const string StatisticsUriFormat = "/statistics/service?" + ClientApiVersionHelper.ApiVersionQueryString;
const string PurgeMessageQueueFormat = "/devices/{0}/commands?" + ClientApiVersionHelper.ApiVersionQueryString;
const string DeviceMethodUriFormat = "/twins/{0}/methods?" + ClientApiVersionHelper.ApiVersionQueryString;
#if ENABLE_MODULES_SDK
const string ModuleMethodUriFormat = "/twins/{0}/modules/{1}/methods?" + ClientApiVersionHelper.ApiVersionQueryString;
#endif

readonly IotHubConnection iotHubConnection;
readonly TimeSpan openTimeout;
readonly TimeSpan operationTimeout;
Expand Down Expand Up @@ -228,7 +227,6 @@ Task<CloudToDeviceMethodResult> InvokeDeviceMethodAsync(Uri uri,

}

#if ENABLE_MODULES_SDK
public override Task<CloudToDeviceMethodResult> InvokeDeviceMethodAsync(string deviceId, string moduleId, CloudToDeviceMethod cloudToDeviceMethod)
{
return this.InvokeDeviceMethodAsync(deviceId, moduleId, cloudToDeviceMethod, CancellationToken.None);
Expand Down Expand Up @@ -281,7 +279,6 @@ public override async Task SendAsync(string deviceId, string moduleId, Message m
throw AmqpErrorMapper.GetExceptionFromOutcome(outcome);
}
}
#endif

async Task<SendingAmqpLink> GetSendingLinkAsync()
{
Expand Down Expand Up @@ -339,13 +336,11 @@ static Uri GetDeviceMethodUri(string deviceId)
return new Uri(DeviceMethodUriFormat.FormatInvariant(deviceId), UriKind.Relative);
}

#if ENABLE_MODULES_SDK
static Uri GetModuleMethodUri(string deviceId, string moduleId)
{
deviceId = WebUtility.UrlEncode(deviceId);
moduleId = WebUtility.UrlEncode(moduleId);
return new Uri(ModuleMethodUriFormat.FormatInvariant(deviceId, moduleId), UriKind.Relative);
}
#endif
}
}
16 changes: 1 addition & 15 deletions iothub/service/src/ClientApiVersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,7 @@ namespace Microsoft.Azure.Devices
class ClientApiVersionHelper
{
const string ApiVersionQueryPrefix = "api-version=";
const string ApiVersionGA = "2016-02-03";
const string ApiVersionApril2016 = "2016-04-30";
const string ApiVersionDMPreview = "2016-04-25-preview";
const string ApiVersionDMPreview2 = "2016-09-30-preview";
const string ApiVersionDMGA = "2016-11-14";
const string ApiVersionJune2017 = "2017-06-30";
const string ApiVersionJuly2017 = "2017-07-11";
const string ApiVersionOctober2017 = "2017-10-15";
#if ENABLE_MODULES_SDK
const string ApiVersionEdgePublicPreview = "2018-03-01-preview";
const string ApiVersionLatest = ApiVersionEdgePublicPreview;
#else
const string ApiVersionLatest = ApiVersionOctober2017;
#endif

const string ApiVersionLatest = "2018-06-30";
public const string ApiVersionQueryString = ApiVersionQueryPrefix + ApiVersionLatest;
public const string ApiVersionQueryStringGA = ApiVersionQueryPrefix + ApiVersionGA;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK
namespace Microsoft.Azure.Devices.Common.Exceptions
{
using System;
using System.Runtime.Serialization;

#if !WINDOWS_UWP
[Serializable]
#endif
public class ConfigurationNotFoundException : IotHubException
{
public ConfigurationNotFoundException(string configurationId)
Expand All @@ -34,12 +31,11 @@ public ConfigurationNotFoundException(string message, Exception innerException)
{
}

#if !WINDOWS_UWP && !NETSTANDARD1_3
#if !NETSTANDARD1_3
public ConfigurationNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK
namespace Microsoft.Azure.Devices.Common.Exceptions
{
using System;
using System.Runtime.Serialization;

#if !WINDOWS_UWP
[Serializable]
#endif
public sealed class ModuleAlreadyExistsException : IotHubException
{
public ModuleAlreadyExistsException(string moduleId)
Expand All @@ -27,12 +24,11 @@ public ModuleAlreadyExistsException(string message, Exception innerException)
{
}

#if !WINDOWS_UWP && !NETSTANDARD1_3
#if !NETSTANDARD1_3
public ModuleAlreadyExistsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK
namespace Microsoft.Azure.Devices.Common.Exceptions
{
using System;
using System.Runtime.Serialization;

#if !WINDOWS_UWP
[Serializable]
#endif

public class ModuleNotFoundException : IotHubException
{
public ModuleNotFoundException(string deviceId, string moduleId)
Expand All @@ -33,12 +29,11 @@ public ModuleNotFoundException(string message, Exception innerException)
{
}

#if !WINDOWS_UWP && !NETSTANDARD1_3
#if !NETSTANDARD1_3
public ModuleNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if ENABLE_MODULES_SDK
namespace Microsoft.Azure.Devices.Common.Exceptions
{
using System;
Expand All @@ -11,9 +10,7 @@ namespace Microsoft.Azure.Devices.Common.Exceptions
/// Exception thrown when the list of input modules is too large for an operation
/// </summary>
///
#if !WINDOWS_UWP
[Serializable]
#endif
public sealed class TooManyModulesOnDeviceException : IotHubException
{
/// <summary>
Expand Down Expand Up @@ -45,12 +42,11 @@ public TooManyModulesOnDeviceException(string message, Exception innerException)
{
}

#if !WINDOWS_UWP && !NETSTANDARD1_3
#if !NETSTANDARD1_3
TooManyModulesOnDeviceException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}
#endif
Loading

0 comments on commit e544966

Please sign in to comment.