Exemplo n.º 1
0
func Init() {
	golog.Info("Init", "Init", "-------init db driver")
	driver.Init()

	golog.Info("Init", "Init", "-------init player session manager")
	G_playerSessionMgr = NewPlayerSessionManager()

	//golog.Info("Init", "Init", "-------init socket dispatcher")
	//	G_dispatcher = NewDispatch()

	golog.Info("Init", "Init", "-------init socket server")
	G_sockServer = NewSocketServer("Socket Server", *config.FLAG_ADDR, 10000000)
}
Exemplo n.º 2
0
//Called by control.RunLift
//Initializes the driver, runs polling from driver to channels and executes orders from channel
func Init(orderedFloorCh <-chan uint, lightCh chan driver.Light, statusCh chan driver.LiftStatus, buttonCh chan<- driver.Button, motorStopCh chan<- bool, quitCh <-chan bool) bool {
	if !driver.Init() {
		log.Fatal("could not initialize driver")
		return false
	}
	// clear all lights and stop motor
	driver.ClearAll()
	log.Println("cleared all lights and stopped motor.")
	var floorSensorCh = make(chan uint, 5)
	var doorTimerCh = make(chan bool, 2)
	var motorDirectionCh = make(chan driver.MotorDirection, 5)
	go driverLoop(lightCh, buttonCh, floorSensorCh, motorDirectionCh, quitCh)
	go executeOrder(orderedFloorCh, lightCh, statusCh, floorSensorCh, doorTimerCh, motorDirectionCh, motorStopCh, quitCh)
	log.Println("fsmElev initialized")
	return true
}