Merge pull request #170 from sebader/master
Update to Windows 1809 and minor changes
This commit is contained in:
Коммит
89a99c3b41
|
@ -1,5 +1,5 @@
|
|||
ARG runtime_base_tag=2.1-runtime-nanoserver-1803
|
||||
ARG build_base_tag=2.1-sdk-nanoserver-1803
|
||||
ARG runtime_base_tag=2.1-runtime-nanoserver-1809
|
||||
ARG build_base_tag=2.1-sdk
|
||||
|
||||
FROM microsoft/dotnet:${build_base_tag} AS build
|
||||
WORKDIR /app
|
||||
|
|
|
@ -139,6 +139,7 @@ namespace OpcPublisher
|
|||
await _edgeHubClient.SetMethodHandlerAsync("UnpublishAllNodes", HandleUnpublishAllNodesMethodAsync, _edgeHubClient);
|
||||
await _edgeHubClient.SetMethodHandlerAsync("GetConfiguredEndpoints", HandleGetConfiguredEndpointsMethodAsync, _edgeHubClient);
|
||||
await _edgeHubClient.SetMethodHandlerAsync("GetConfiguredNodesOnEndpoint", HandleGetConfiguredNodesOnEndpointMethodAsync, _edgeHubClient);
|
||||
await _edgeHubClient.SetMethodDefaultHandlerAsync(DefaultMethodHandlerAsync, _edgeHubClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -165,6 +166,7 @@ namespace OpcPublisher
|
|||
await _iotHubClient.SetMethodHandlerAsync("UnpublishAllNodes", HandleUnpublishAllNodesMethodAsync, _iotHubClient);
|
||||
await _iotHubClient.SetMethodHandlerAsync("GetConfiguredEndpoints", HandleGetConfiguredEndpointsMethodAsync, _iotHubClient);
|
||||
await _iotHubClient.SetMethodHandlerAsync("GetConfiguredNodesOnEndpoint", HandleGetConfiguredNodesOnEndpointMethodAsync, _iotHubClient);
|
||||
await _edgeHubClient.SetMethodDefaultHandlerAsync(DefaultMethodHandlerAsync, _iotHubClient);
|
||||
}
|
||||
}
|
||||
Logger.Debug($"Init D2C message processing");
|
||||
|
@ -697,6 +699,24 @@ namespace OpcPublisher
|
|||
return methodResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method that is called for any unimplemented call. Just returns that info to the caller
|
||||
/// </summary>
|
||||
/// <param name="methodRequest"></param>
|
||||
/// <param name="userContext"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<MethodResponse> DefaultMethodHandlerAsync(MethodRequest methodRequest, object userContext)
|
||||
{
|
||||
Logger.Information($"Received direct method call for {methodRequest.Name} which is not implemented");
|
||||
string response = $"Method {methodRequest.Name} successfully received but this method is not implemented";
|
||||
|
||||
string resultString = JsonConvert.SerializeObject(response);
|
||||
byte[] result = Encoding.UTF8.GetBytes(resultString);
|
||||
MethodResponse methodResponse = new MethodResponse(result, (int)HttpStatusCode.OK);
|
||||
return methodResponse;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes internal message processing.
|
||||
/// </summary>
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpcPublisher
|
|||
try
|
||||
{
|
||||
// connect to EdgeHub
|
||||
HubProtocol = TransportType.Amqp_Tcp_Only;
|
||||
HubProtocol = TransportType.Mqtt_Tcp_Only;
|
||||
Logger.Information($"Create IoTEdgeHub module client using '{HubProtocol}' for communication.");
|
||||
ModuleClient hubClient = await ModuleClient.CreateFromEnvironmentAsync(HubProtocol);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче