import PlugUnplug.messages.*;

protocol PlugUnplug {
  role HCD, USB_Manager, Driver, SKB;

  choice from HCD to USB_Manager {
    notify_new_device(port):
      // step 2
      dctrl_exe(req,buf,sz,addr,id) from USB_Manager to HCD;
      dctrl_done(id) from HCD to USB_Manager;
      // step 3
      dctrl_exe(req,buf,sz,addr,id) from USB_Manager to HCD;
      dctrl_done(id) from HCD to USB_Manager;
      dctrl_exe(req,buf,sz,addr,id) from USB_Manager to HCD;
      dctrl_done(id) from HCD to USB_Manager;
      // step 4
      ctrl_exe(req,dev,id) from USB_Manager to HCD;
      ctrl_done(id) from HCD to USB_Manager;
      dctrl_exe(req,buf,sz,addr,id) from USB_Manager to HCD;
      dctrl_done(id) from HCD to USB_Manager;
      // step 5
      ctrl_exe(req,dev,id) from USB_Manager to HCD;
      ctrl_done(id) from HCD to USB_Manager;
      // step 6
      get_addr(dev,buf,id) from USB_Manager to SKB;
      get_addr_done(id) from SKB to USB_Manager;
      // step 7
      probe(dev,class,prot) from USB_Manager to Driver;
      choice from Driver to USB_Manager {
        probe_done(ACCEPT,dev):
          pipe_req(dev,type,dir) from Driver to USB_Manager;
          pipe_resp(resp,pipe) from USB_Manager to Driver;
        probe_done(REJECT,dev):
          // clean-up
      }
   	notify_device_removal(port):
      disconnect(dev) from USB_Manager to Driver;
  }
}

