Update (develop) GCI - GciBridge - big change - for implement to GenesisHead and SmartReader
This commit is contained in:
@@ -165,10 +165,10 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
/// <param name="portName">Name of the port (e.g. COM3).</param>
|
||||
/// <param name="baudRateText">Baud rate entered in the UI.</param>
|
||||
/// <returns>
|
||||
/// Instance of <see cref="GciPublicModels.GciPortConfig"/> or null if port name is empty.
|
||||
/// Instance of <see cref="PublicModels.GciPortConfig"/> or null if port name is empty.
|
||||
/// </returns>
|
||||
/// <exception cref="Exception">Thrown when baud rate is invalid.</exception>
|
||||
private GciPublicModels.GciPortConfig CreateGciPortConfig(string portName, string baudRateText)
|
||||
private PublicModels.GciPortConfig CreateGciPortConfig(string portName, string baudRateText)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(portName))
|
||||
return null;
|
||||
@@ -176,7 +176,7 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
if (!int.TryParse(baudRateText, out int baudRate))
|
||||
throw new Exception($"Invalid baud rate for port {portName}.");
|
||||
|
||||
return new GciPublicModels.GciPortConfig
|
||||
return new PublicModels.GciPortConfig
|
||||
{
|
||||
PortName = portName,
|
||||
Type = "Serial",
|
||||
@@ -186,27 +186,27 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
/// <summary>
|
||||
/// Gets selected configuration source from UI and maps it to public GCI model.
|
||||
/// </summary>
|
||||
/// <returns>Selected <see cref="GciPublicModels.GciConfigSource"/>.</returns>
|
||||
/// <returns>Selected <see cref="PublicModels.GciConfigSource"/>.</returns>
|
||||
/// <exception cref="Exception">Thrown when no value is selected.</exception>
|
||||
private GciPublicModels.GciConfigSource GetConfigSource()
|
||||
private PublicModels.GciConfigSource GetConfigSource()
|
||||
{
|
||||
if (cmbConfigSource.SelectedItem == null)
|
||||
throw new Exception("Config source is not selected.");
|
||||
|
||||
return (GciPublicModels.GciConfigSource)cmbConfigSource.SelectedItem;
|
||||
return (PublicModels.GciConfigSource)cmbConfigSource.SelectedItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets selected password source from UI and maps it to public GCI model.
|
||||
/// </summary>
|
||||
/// <returns>Selected <see cref="GciPublicModels.GciPasswordSource"/>.</returns>
|
||||
/// <returns>Selected <see cref="PublicModels.GciPasswordSource"/>.</returns>
|
||||
/// <exception cref="Exception">Thrown when no value is selected.</exception>
|
||||
private GciPublicModels.GciPasswordSource GetPasswordSource()
|
||||
private PublicModels.GciPasswordSource GetPasswordSource()
|
||||
{
|
||||
if (cmbPasswordSource.SelectedItem == null)
|
||||
throw new Exception("Password source is not selected.");
|
||||
|
||||
return (GciPublicModels.GciPasswordSource)cmbPasswordSource.SelectedItem;
|
||||
return (PublicModels.GciPasswordSource)cmbPasswordSource.SelectedItem;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -229,7 +229,7 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
|
||||
await ExecuteApiActionAsync(async () =>
|
||||
{
|
||||
var request = new GciPublicModels.GciInitSlotRequest
|
||||
var request = new PublicModels.GciInitSlotRequest
|
||||
{
|
||||
SlotId = slot,
|
||||
ConfigSource = GetConfigSource(),
|
||||
@@ -308,7 +308,7 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
|
||||
await ExecuteApiActionAsync(async () =>
|
||||
{
|
||||
GciPublicModels.GciGetPcbIdResult result =
|
||||
PublicModels.GciGetPcbIdResult result =
|
||||
await _api.GetPcbIdAsync(slot);
|
||||
|
||||
if (!result.Success)
|
||||
@@ -428,9 +428,9 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
|
||||
await ExecuteApiActionAsync(async () =>
|
||||
{
|
||||
bool ok = await _api.SetMeterPasswordAsync(slot, password);
|
||||
PublicModels.GciSetPasswordResult result = await _api.SetMeterPasswordAsync(slot, password);
|
||||
|
||||
if (!ok)
|
||||
if (!result.Success)
|
||||
throw new Exception("Set password failed.");
|
||||
|
||||
MessageBox.Show("Password set successfully.");
|
||||
|
||||
+2
-2
@@ -152,9 +152,9 @@ namespace GenesisCordonelInterface.UI.StaraTuraAPI_GenesisCordonelInterface
|
||||
|
||||
foreach (int slot in _api.GetSelectedSlots())
|
||||
{
|
||||
bool ok = await _api.SetMeterPasswordAsync(slot, password);
|
||||
PublicModels.GciSetPasswordResult result = await _api.SetMeterPasswordAsync(slot, password);
|
||||
|
||||
if (!ok)
|
||||
if (!result.Success)
|
||||
throw new Exception($"Slot {slot}: Set password failed.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user