working voor verlof
This commit is contained in:
parent
5b55bd3b27
commit
cb22394b3b
6 changed files with 75 additions and 40 deletions
|
|
@ -4,11 +4,12 @@
|
|||
EpdBase::Epd2U::Epd2U(int comport)
|
||||
{
|
||||
port = comport;
|
||||
CommsInitialized = 0;
|
||||
SetAutoCommit(0);
|
||||
Error = 123;
|
||||
|
||||
//SetTimeouts(port, 20, 1000, 1000);
|
||||
//SetDiscoveryExpirationPeriod(port, 5000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -17,6 +18,10 @@ DWORD EpdBase::Epd2U::StartCom()
|
|||
Error = 0;
|
||||
InitRv = InitComms(port, 9600, 8, 0, 0);
|
||||
if (InitRv == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
else {
|
||||
CommsInitialized = 1;
|
||||
SetDiscoveryExpirationPeriod(port, 5000);
|
||||
}
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
|
@ -27,19 +32,31 @@ EpdBase::Epd2U::~Epd2U()
|
|||
}
|
||||
|
||||
|
||||
void EpdBase::Epd2U::StartDiscover()
|
||||
int EpdBase::Epd2U::StartDiscover()
|
||||
{
|
||||
Error = 0;
|
||||
FlushDiscoveryCache(port);
|
||||
DiscRV= Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
|
||||
Commit();
|
||||
if (DiscRV == 1 && DeviceCount == 0)
|
||||
if (DiscRV == 1 && DeviceCount == 0)
|
||||
{
|
||||
OnRV = EpdOn();
|
||||
Commit();
|
||||
Sleep(1100);
|
||||
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
|
||||
Commit();
|
||||
}
|
||||
DeinitComms(port);
|
||||
Sleep(100);
|
||||
InitRv = InitComms(port, 9600, 8, 0, 0);
|
||||
if (InitRv == 1) {
|
||||
CommsInitialized = 1;
|
||||
SetDiscoveryExpirationPeriod(port, 5000);
|
||||
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
|
||||
Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DiscRV;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace EpdBase
|
|||
WORD OtherAlarms;
|
||||
WORD EEPROMBadSectors;
|
||||
|
||||
|
||||
WORD CommsInitialized = 0;
|
||||
WORD InitRv = 0;
|
||||
WORD DiscRV = 0;
|
||||
WORD ConRV = 0;
|
||||
|
|
@ -199,7 +201,7 @@ namespace EpdBase
|
|||
BYTE byStatus3;
|
||||
BYTE byStatus4;
|
||||
|
||||
void StartDiscover();
|
||||
int StartDiscover();
|
||||
void Open(DWORD DeviceID);
|
||||
void Close();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ int EpdBaseClr::Epd2::Connect()
|
|||
{
|
||||
epd->StartCom();
|
||||
b->CurrentDeviceID = 0;
|
||||
epd->StartDiscover();
|
||||
DiscRV = epd->DeviceCount;
|
||||
DeviceCount = epd->DeviceCount;
|
||||
if (epd->DiscRV == 1 && epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
|
||||
DiscRV = epd->StartDiscover();
|
||||
if (DiscRV == 1)
|
||||
{
|
||||
DeviceCount = epd->DeviceCount;
|
||||
if (epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
}
|
||||
return DiscRV;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,14 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||
<telerik:RadToggleButton Name="cbAlara" HorizontalAlignment="Left" Width="150" Content="Normal" TextBlock.FontSize="24" Checked="CbAlara_Checked" Unchecked="CbAlara_Checked" IsChecked="False" CornerRadius="15" />
|
||||
<telerik:RadToggleButton Name="cbNormal" HorizontalAlignment="Left" Width="150" Content="Normal" TextBlock.FontSize="24" Click="CbNormal_Click" IsChecked="True" CornerRadius="15" />
|
||||
<telerik:RadToggleButton Name="cbAlara" HorizontalAlignment="Left" Width="150" Content="Alara" TextBlock.FontSize="24" Click="CbAlara_Click" IsChecked="False" CornerRadius="15" />
|
||||
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" FontSize="36" TextAlignment="Center" Text="Choose a task" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="3">
|
||||
<telerik:RadToggleButton Name="cbInst1" HorizontalAlignment="Left" Width="150" Content="Inst1" TextBlock.FontSize="24" Checked="CbInst1_Checked" Unchecked="CbInst1_Checked" IsChecked="True" CornerRadius="15" />
|
||||
<telerik:RadToggleButton Name="cbInst2" HorizontalAlignment="Left" Width="150" Content="Inst2" TextBlock.FontSize="24" Checked="CbInst2_Checked" Unchecked="CbInst2_Checked" IsChecked="false" Visibility="Collapsed" CornerRadius="15" />
|
||||
<telerik:RadToggleButton Name="cbInst1" HorizontalAlignment="Left" Width="150" Content="Inst1" TextBlock.FontSize="24" Click="CbInst1_Click" IsChecked="True" CornerRadius="15" />
|
||||
<telerik:RadToggleButton Name="cbInst2" HorizontalAlignment="Left" Width="150" Content="Inst2" TextBlock.FontSize="24" Click="CbInst2_Click" IsChecked="false" Visibility="Collapsed" CornerRadius="15" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace eDosStation
|
|||
return false;
|
||||
|
||||
}
|
||||
statusEPD.Text = $"EPD: {ep.b.CurrentDeviceID}";
|
||||
statusEPD.Text = $"EPD: {ep.EpdID}";
|
||||
ep.ReadTresholds();
|
||||
|
||||
return rv;
|
||||
|
|
@ -80,6 +80,7 @@ namespace eDosStation
|
|||
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
dispatcherTimer.Stop();
|
||||
ep.Close();
|
||||
ep.Connect();
|
||||
if (ep.DeviceCount == 1)
|
||||
{
|
||||
|
|
@ -98,7 +99,6 @@ namespace eDosStation
|
|||
{
|
||||
statusEPD.Text = $"Search Timeout";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ namespace eDosStation
|
|||
if (_User == null || CurTaskRow == null) return;
|
||||
|
||||
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
int ok = ep.Connect();
|
||||
if (ep.DeviceCount == 1)
|
||||
{
|
||||
EpdFound = true;
|
||||
|
|
@ -208,9 +208,8 @@ namespace eDosStation
|
|||
|
||||
private void SetFilter(bool isAlara)
|
||||
{
|
||||
Inst1 = cbInst1.IsChecked == true;
|
||||
Inst2 = cbInst2.IsChecked == true;
|
||||
|
||||
Inst1 = (cbInst1.IsChecked ==true);
|
||||
Inst2 = (cbInst2.IsChecked ==true);
|
||||
|
||||
StringBuilder fi = new StringBuilder();
|
||||
if (!Inst1 && !Inst2)
|
||||
|
|
@ -391,39 +390,49 @@ namespace eDosStation
|
|||
|
||||
|
||||
|
||||
private void CbAlara_Checked(object sender, RoutedEventArgs e)
|
||||
|
||||
|
||||
|
||||
private void CbInst1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!initialising) {
|
||||
Inst1 = (cbInst1.IsChecked == true);
|
||||
cbInst2.IsChecked = !Inst1;
|
||||
bool isAlara = (cbAlara.IsChecked == true);
|
||||
if (isAlara) cbAlara.Content = "Alara"; else cbAlara.Content = "Normal";
|
||||
SetFilter(isAlara);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CbInst1_Checked(object sender, RoutedEventArgs e)
|
||||
private void CbAlara_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!initialising)
|
||||
{
|
||||
Inst1 = (cbInst1.IsChecked == true);
|
||||
//Inst2 = (cbInst2.IsChecked == true);
|
||||
bool isAlara = (cbAlara.IsChecked == true);
|
||||
bool isAlara = true;
|
||||
cbAlara.IsChecked = true;
|
||||
cbNormal.IsChecked = !isAlara;
|
||||
SetFilter(isAlara);
|
||||
}
|
||||
}
|
||||
|
||||
private void CbInst2_Checked(object sender, RoutedEventArgs e)
|
||||
private void CbNormal_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!initialising)
|
||||
{
|
||||
//Inst1 = (cbInst1.IsChecked == true);
|
||||
Inst2 = (cbInst2.IsChecked == true);
|
||||
bool isAlara = (cbAlara.IsChecked == true);
|
||||
bool isAlara = false;
|
||||
cbAlara.IsChecked = isAlara;
|
||||
cbNormal.IsChecked = !isAlara;
|
||||
SetFilter(isAlara);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CbInst2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Inst2 = (cbInst2.IsChecked == true);
|
||||
cbInst1.IsChecked = !Inst2;
|
||||
bool isAlara = (cbAlara.IsChecked == true);
|
||||
SetFilter(isAlara);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Starter()
|
||||
{
|
||||
|
|
@ -445,13 +454,13 @@ namespace eDosStation
|
|||
|
||||
cbInst1.Content = thisStation.Inst_Name1;
|
||||
Inst1 = true;
|
||||
cbInst1.IsChecked = true;
|
||||
cbInst1.IsChecked = Inst1;
|
||||
if (thisStation.Inst_CODE2 > 0)
|
||||
{
|
||||
cbInst2.Content = thisStation.Inst_Name2;
|
||||
cbInst2.Visibility = Visibility.Visible;
|
||||
Inst2 = true;
|
||||
cbInst2.IsChecked = true;
|
||||
Inst2 = false;
|
||||
cbInst2.IsChecked = Inst2;
|
||||
}
|
||||
//eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
|
||||
////using (eDosStation.DataSet1TableAdapters.GetTaskListTableAdapter dataSet1GetTaskListTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskListTableAdapter())
|
||||
|
|
|
|||
|
|
@ -60,11 +60,12 @@ namespace eDosStation
|
|||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
int ConnectRV = 0;
|
||||
System.Diagnostics.Debug.WriteLine(thisStation.ComPort.ToString());
|
||||
try
|
||||
{
|
||||
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
ep.Connect();
|
||||
ConnectRV = ep.Connect();
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error loading dll's");
|
||||
|
|
@ -91,6 +92,7 @@ namespace eDosStation
|
|||
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
dispatcherTimer.Stop();
|
||||
ep.Close();
|
||||
ep.Connect();
|
||||
if (ep.DeviceCount == 1 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue