unit AAAUtl;{to delete}xxx

interface

function AS_STATUS_ToString(AStatus: word): string;

function AS_STATUS_Decode(AStatus: word) : byte;

{c:\mikro\analytik.pas}
{c:\mikro\jazyk_en.pas}
{c:\mikro\deklarac.pas}

type
  TASState = integer;
{assXXXX}
const

  astOK = 0;
  astPrepared = 1;
  astOperating = 2;

  astError = 3;

  astCalibrationError = 3;
  astSensorAError = 4;
  astSensorBError = 5;
  astSequencerError = 6;
  astArmMotorError = 7;
  astPeristalticMotorError = 8;
  astDCMotorError = 9;
  astDiskPositionError = 10;
  astBubbleError = 11;
  astUnidentifiedError = 12;
  astCommunicationError = 13;
  astUnknownState = 14;

  ASStateCount = 15;
{/assXXXX}

implementation

const
  AAStatusMsgs : array[0..ASStateCount - 1] of string[35] =    { 40 }
	    (
{ Error  0     'Dávkovač je v základní pozici  ',
{ Error  0}    'Sampler in its basic position  ',
       { 1     'Vzorek připraven ve smyčce     ',
       { 1}    'Sample prepared in the loop    ',
       { 2     'Dávkovač pracuje               ',
       { 2}    'Sampler operating              ',
       { 3     'Nelze nastavit citlivost čidel ',
       { 3}    'Sensor sensit. cannot be set   ',
       { 4     'Chyba čidla A nebo není vzorek ',
       { 4}    'Sensor A error or no sample    ',
       { 5     'Chyba čidla B nebo bublina     ',
       { 5}    'Sensor B error or a bubble     ',
       { 6     'Chyba v sekvenceru dávkování   ',
       { 6}    'Error in sampler sequencer     ',
       { 7     'Chyba v motoru raménka         ',
       { 7}    'Arm motor error                ',
       { 8     'Chyba v motoru peristaltiky    ',
       { 8}    'Peristaltic system motor error ',
       { 9     'Chyba v některém DC motoru     ',
       { 9}    'Error in some of the DC motors ',
       {10     'Chyba polohování kotouče       ',
       {10}    'Disk position error            ',
       { ---------------------------------------}
       {11     'Bublina ve vzorku; málo vzorku ',
       {11}    'Bubble or not enought of sample',
      {>11     'Neidentifikovatelná chyba      '
      {>11}    'Unidentified error             ',
               'Communication error',
               'Unknown state'
	    );


function AS_STATUS_ToString(AStatus: word): string;
begin
  Result := AAStatusMsgs[AS_Status_Decode(AStatus)];
end;

function AS_STATUS_Decode(AStatus: word) : byte;
var ST : integer;
begin
   ST:= AStatus;{IPOD_ST;}
   if      ST=0   then Result:=0
   else if ST=$81 then Result:=1
   else if ST>0   then Result:=2
   else if ST and $FF00 =$FD00 then
   begin	{ Sekvencer }
    if      ST and $FF=$88 then Result:=3
    else if ST and $FF=$89 then Result:=4
    else if ST and $FF=$8A then Result:=5
    else Result:=6
   end
   else if ST and $FF00 =$FE00 then
   begin	{ Multi reg }
    if      ST and $FF=$90 then Result:=7
    else if ST and $FF=$91 then Result:=8
    else Result:=9
   end
   else if ST and $FF00 =$FC00 then
   begin	{ Krokac }
     Result:=10
   end
   else Result:=12;
end;

end.
