Update (develop) - GCI - GciBridge - better return for Connect
This commit is contained in:
parent
953b02a6e8
commit
76e7ccb4a6
@ -716,7 +716,7 @@ namespace GenesisCordonelInterface.API
|
|||||||
|
|
||||||
if (!meter.IsLoggedOn)
|
if (!meter.IsLoggedOn)
|
||||||
{
|
{
|
||||||
meter.Login();
|
meter.Login2();
|
||||||
|
|
||||||
if (meter.IsLoggedOn)
|
if (meter.IsLoggedOn)
|
||||||
{
|
{
|
||||||
@ -738,7 +738,9 @@ namespace GenesisCordonelInterface.API
|
|||||||
Success = false,
|
Success = false,
|
||||||
SlotId = slot,
|
SlotId = slot,
|
||||||
IsLoggedOn = false,
|
IsLoggedOn = false,
|
||||||
Message = "Login failed"
|
Message = string.IsNullOrWhiteSpace(meter.LastLoginError)
|
||||||
|
? "Login failed"
|
||||||
|
: meter.LastLoginError
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,7 +790,7 @@ namespace GenesisCordonelInterface.API
|
|||||||
|
|
||||||
if (!meter.IsConnected)
|
if (!meter.IsConnected)
|
||||||
{
|
{
|
||||||
meter.ConnectMeter();
|
meter.ConnectMeter2();
|
||||||
|
|
||||||
LogInfo(operation, $"New Slot {slot} connection success.");
|
LogInfo(operation, $"New Slot {slot} connection success.");
|
||||||
|
|
||||||
@ -796,21 +798,10 @@ namespace GenesisCordonelInterface.API
|
|||||||
{
|
{
|
||||||
Success = true,
|
Success = true,
|
||||||
SlotId = slot,
|
SlotId = slot,
|
||||||
IsConnected = true,
|
IsConnected = meter.IsConnected,
|
||||||
Message = "Connected now"
|
Message = meter.IsConnected
|
||||||
};
|
? "Connected now"
|
||||||
}
|
: meter.LastConnectError
|
||||||
|
|
||||||
if (!meter.IsConnected)
|
|
||||||
{
|
|
||||||
LogInfo(operation, $"Failed Slot {slot} connection.");
|
|
||||||
|
|
||||||
return new PublicModels.GciConnectResult
|
|
||||||
{
|
|
||||||
Success = false,
|
|
||||||
SlotId = slot,
|
|
||||||
IsConnected = false,
|
|
||||||
Message = "Connect failed"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -467,7 +467,7 @@ namespace TBF.Rig.BridgeComponents.GciBridge
|
|||||||
/// -> InterfaceOutsideToGCI.ConnectOneSlotAsync()
|
/// -> InterfaceOutsideToGCI.ConnectOneSlotAsync()
|
||||||
/// -> InterfaceGCIToLaatzen.ConnectOneMeterAsync()
|
/// -> InterfaceGCIToLaatzen.ConnectOneMeterAsync()
|
||||||
/// -> per-slot GCI worker
|
/// -> per-slot GCI worker
|
||||||
/// -> MeterBatch.MetersLogin()
|
/// -> Protocols connect to ports
|
||||||
/// -> GenesisMeter register snapshot
|
/// -> GenesisMeter register snapshot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="slotId">Slot number.</param>
|
/// <param name="slotId">Slot number.</param>
|
||||||
@ -489,11 +489,34 @@ namespace TBF.Rig.BridgeComponents.GciBridge
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<GciPublicModels.GciLoginResult> LoginAsync(
|
/// <summary>
|
||||||
int slot,
|
/// Logs in to the meter assigned to the requested slot.
|
||||||
CancellationToken token = default)
|
///
|
||||||
|
/// Trace:
|
||||||
|
/// GciBridge.LoginAsync()
|
||||||
|
/// -> InterfaceOutsideToGCI.LoginOneSlotAsync()
|
||||||
|
/// -> InterfaceGCIToLaatzen.LoginOneMeterAsync()
|
||||||
|
/// -> per-slot GCI worker
|
||||||
|
/// -> MeterBatch.MetersLogin()
|
||||||
|
/// -> GenesisMeter login state
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="slotId">Slot number.</param>
|
||||||
|
/// <param name="token">Cancellation token.</param>
|
||||||
|
/// <returns>Login result for the requested slot.</returns>
|
||||||
|
public async Task<GciPublicModels.GciLoginResult> LoginAsync(
|
||||||
|
int slotId,
|
||||||
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
return gciExternalInterface.LoginOneSlotAsync(slot, token);
|
EnsureExternalInterface();
|
||||||
|
|
||||||
|
if (slotId <= 0)
|
||||||
|
throw new ArgumentException("Invalid slot id.");
|
||||||
|
|
||||||
|
var result = await gciExternalInterface.LoginOneSlotAsync(slotId, token);
|
||||||
|
|
||||||
|
log.InfoFormat("{0}: LoginAsync({1}) invoked. Result={2}", Name, slotId, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -4434,10 +4434,6 @@
|
|||||||
<Project>{439D0878-C76E-452B-B17D-209A89E91D36}</Project>
|
<Project>{439D0878-C76E-452B-B17D-209A89E91D36}</Project>
|
||||||
<Name>Dirichlet.Numerics</Name>
|
<Name>Dirichlet.Numerics</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\ExternalProjects\Laatzen\Genesis\Common\CommonCore\CommonCore.csproj">
|
|
||||||
<Project>{1b02c79e-0b19-43e2-8f6b-71ef0c786c97}</Project>
|
|
||||||
<Name>CommonCore</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\GemCard\GemCard.csproj">
|
<ProjectReference Include="..\GemCard\GemCard.csproj">
|
||||||
<Project>{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}</Project>
|
<Project>{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}</Project>
|
||||||
<Name>GemCard</Name>
|
<Name>GemCard</Name>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user