def next(self, input):
        action = map(DriverAction.DriverAction, [input["action"]])[0]
        if action == DriverAction.start:
            global LOCAL_ADDR, RSN_ADDR, ROUTE_NO, DIRECTION, BUS_ID, WATCHDOG
            
            ROUTE_NO = input["route"]
            DIRECTION = input["direction"]
            Location.setLocation(int(input["location"]))
            
            # TODO: ping RSN to add into the group
            add_message = {
                           "SM" : "GSN_SM",
                           "action" : "recvBusReq",
                           "type" : "add",
                           "route" : ROUTE_NO,
                           "direction" : DIRECTION,
                           "busId" : BUS_ID,
                           "location" : Location.getLocation(), 
                           "busIP" : LOCAL_ADDR.ip,
                           "busPort" : LOCAL_ADDR.port
                           }
            # TODO: should use real gsn 
            MessagePasser.directSend(GSN_ADDR.ip, GSN_ADDR.port, add_message)
            
            # start the watchdog
            WATCHDOG.startWatchdog()
            
            return DriverSM.Init_Waiting
        elif action == DriverAction.timeout:
            # TODO: re-ping
            return DriverSM.Idle
        elif action == DriverAction.turnOff:
            # TODO: do something to shut-down
            RESEND_ELECT_NUM = 0
            WATCHDOG.stopWatchdog()

            return DriverSM.Off
        else:
            # for other illegal action
            # assert 0, "Idle: invalid action: %s" % str(input)
            pass