#INCLUDE "srv1.inc"
#INCLUDE "leds.occ"

PROC system (SYSTEM? svr, SHARED TWI! twi)
  CHAN P.LED led:
  PAR
    leds (led)
    INITIAL BOOL done IS FALSE:
    WHILE NOT done
      svr[req] ? CASE
        disconnected
          SEQ
            led ! disconnected
            done := TRUE

        get.version
          -- FIXME: handle this properly
          svr[rsp] ! version; 0; "UNKNOWN VERSION"

        open.twi
          svr[rsp] ! twi; twi

        BOOL b:
        INT n:
        set.led; n; b
          led ! led; n; b
:

