Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
KerlyJiang1 committed Dec 9, 2019
2 parents fdfe4d6 + fbf2438 commit 953561d
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ public async Task<Metric> GetMetricAsync(GetMetricRequest request, DateTime? dea
};
}

public async Task<Switch> GetSwitchAsync(GetSwitchRequest request, DateTime? deadline)
{
if (request is null)
{
throw new ArgumentNullException(nameof(request));
}

PlcFrame response = await this.InvokeAsync(
PlcFrame.Create(PlcMessageType.GetSwitchRequest, ByteString.Empty),
deadline)
.ConfigureAwait(false);
if (response.FrameHeader.MessageType != PlcMessageType.GetSwitchResponse)
{
throw new InvalidDataException(
"Response message type mismatch: " + response.FrameHeader.MessageType);
}

using var reader = new BinaryReader(new MemoryStream(response.FrameBody.ToByteArray()));
return new Switch
{
DevicePowerOn = reader.ReadByte() != 0,
ExhausterPowerOn = reader.ReadByte() != 0,
HeaterAutoOn = reader.ReadByte() != 0,
HeaterPowerOn = reader.ReadByte() != 0,
HeaterFanOn = reader.ReadByte() != 0,
HeaterCompressorOn = reader.ReadByte() != 0,
HeaterFourWayReversingOn = reader.ReadByte() != 0,
};
}

public async Task<Switch> UpdateSwitchAsync(UpdateSwitchRequest request, DateTime? deadline)
{
if (request is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected virtual void Dispose(bool disposing)
[SuppressMessage("样式", "IDE0060:删除未使用的参数", Justification = "Required for callback delegate.")]
private void HearbeatEntryPoint(object state)
{
foreach (var entry in this.devices)
foreach (DeviceOptionsEntry entry in this.devices)
{
// TODO(zhangshuai.ustc): Implement it.
// 1. Get corresponding grpc client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0" DevelopmentDependency="true" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0" DevelopmentDependency="true" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Task StartAsync(CancellationToken cancellationToken)
{
this.logger.LogInformation(
"Grpc services are listening on {}",
string.Join(",", this.server.Ports.Select(p => $"{p.Host}:{p.Port}")));
string.Join(",", this.server.Ports.Select(p => $"{p.Host}:{p.BoundPort}")));
}

return Task.CompletedTask;
Expand Down

This file was deleted.

Loading

0 comments on commit 953561d

Please sign in to comment.