' iBIrHello.ibas
{CREATORID "LDis"}
{VERSION "1.0"}

BEGIN
 L$=CHR$(10)
 OPEN IR @9600 AS #1
 A=FILEERROR
 IF A=1 THEN
  A=MESSAGEBOX("Error while opening IR"+L$+"Exiting...",1)
  END
 END IF
 BUTTON #1,"Send Hello by IR",40,70,80,30
 S$="Hello from "+HOTSYNCINFO$(2)
 REPEAT
  INPUT #1,A$
  IF A$<>"" LET A=MESSAGEBOX("Received:"+L$+A$,1)
  E=DOEVENTS
  IF E=1 THEN
   PRINT #1,S$
   A=FILEERROR
   IF A=1 THEN
    A=MESSAGEBOX("Error while IR sending"+L$+"Try again...",1)
   END IF
  END IF
 UNTIL E=-1
 CLOSE #1
 A=FILEERROR
 IF A=1 THEN
  A=MESSAGEBOX("Error while closing IR",1)
 END IF
END
