• matthew@hierthinking.com

Forum

Please or Register to create posts and topics.

Read alarm history issue

I want to read alarm history and I use this hardcoded function to test

private void getAlmarsHistory()
{
if (handle_ == 0)
{
Console.WriteLine("Error on H");
}
ushort hisNo = 0;

Focas1.ODBAHIS userAlmHistory = new Focas1.ODBAHIS();
ret_ = Focas1.cnc_stopomhis(handle_);
if (ret_ != Focas1.EW_OK)
{
MessageBox.Show($"Erro de função codigo Nº {ret_}", "AVISO", MessageBoxButtons.OK);
}
ret_ = Focas1.cnc_rdalmhisno(handle_, out hisNo);
int numbHis = 0;
numbHis = hisNo * 56;
ushort hisNumb = ((ushort)numbHis);
//hisLengh = (56 * numbHis);
if (ret_ != Focas1.EW_OK)
{
MessageBox.Show($"Erro de função codigo Nº {ret_}", "AVISO", MessageBoxButtons.OK);
}
ret_ = Focas1.cnc_rdalmhistry(handle_, 0, hisNo, hisNumb, userAlmHistory);
if (ret_ != Focas1.EW_OK)
{
MessageBox.Show($"Erro de função codigo Nº {ret_}", "AVISO", MessageBoxButtons.OK);
}
ret_ = Focas1.cnc_startophis(handle_);
if (ret_ != Focas1.EW_OK)
{
MessageBox.Show($"Erro de função codigo Nº {ret_}", "AVISO", MessageBoxButtons.OK);
}
}

After function, ret_ = Focas1.cnc_rdalmhistry(handle_, 0, hisNo, hisNumb, userAlmHistory); is called the return is allways 1

If I don´t restart Focas1.cnc_startophis(handle_), second time the function Focas1.cnc_startophis(handle_) is called the retur is -1

EW_BUSY (-1)  cnc_stopophis function has been executed.

But the function cnc_rdalmhistry return 1 again.

EW_FUNC (1) cnc_stopophis  function has not been executed.

Any one who could help me I appreciate