예제 #1
0
func CallbackKill(af *at.AtFrame) bool {
	ad.Println("callback kill")

	js.SetJEUStateEnding(af.GetId())

	return true
}
예제 #2
0
func NewAtDebugServer(id string, af *at.AtFrame) (*AtDebug, error) {

	ad := &AtDebug{}

	ad.AF = af
	ad.ZmqContext = af.ZmqContext

	ad.ServerMode = true

	ad.cmdPULL, _ = ad.ZmqContext.NewSocket(zmq.PULL)
	ad.cmdPULL.Bind(AD_ZMQ_PROXY_PULL + id)

	ad.pollIndex, _ = af.AppendZmqPollItem(zmq.PollItem{Socket: ad.cmdPULL, Events: zmq.POLLIN})

	if dir, err := filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
		return nil, err
	} else {
		ad.RootPath = dir + "/"
	}

	ad.LogPath = "log/"
	ad.FileName = "log"

	ad.logFile = nil

	ad.ResetServer()

	return ad, nil
}
예제 #3
0
func NewAtReportServer(id string, af *at.AtFrame) (*AtReport, error) {

	ar := &AtReport{}

	ar.AF = af
	ar.ZmqContext = af.ZmqContext

	ar.ServerMode = true

	ar.cmdPULL, _ = ar.ZmqContext.NewSocket(zmq.PULL)
	ar.cmdPULL.Bind(AR_ZMQ_PROXY_PULL + id)

	ar.pollIndex, _ = af.AppendZmqPollItem(zmq.PollItem{Socket: ar.cmdPULL, Events: zmq.POLLIN})

	if dir, err := filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
		return nil, err
	} else {
		ar.RootPath = dir + "/"
	}

	ar.ReportPath = "report/"
	ar.FileName = "rpt"

	ar.rptFile = nil

	ar.ResetServer()
	ar.toWeb = make(chan []byte)
	ar.manager = make(chan net.Conn)
	go ar.RunForWeb()

	return ar, nil
}
예제 #4
0
// STOP 수신 이벤트
func CallbackStop(af *at.AtFrame) bool {
	ad.Println("callback stop")
	js.SetJEUStateStopping(af.GetId())

	wg := sync.WaitGroup{}
	wg.Add(2)
	go func() { stopRX <- true; wg.Done() }()
	go func() { stopTX <- true; wg.Done() }()
	wg.Wait()

	js.SetJEUStateReady(af.GetId())

	return false
}
예제 #5
0
// STOP 수신 이벤트
func CallbackStop(af *at.AtFrame) bool {
	ad.Println("callback stop")
	js.SetJEUStateStopping(af.GetId())

	ThreadCheckMsgReqEnd = true

	for {
		time.Sleep(time.Millisecond)
		if !ThreadCheckMsgRun {
			break
		}
	}

	js.SetJEUStateReady(af.GetId())

	return false
}
예제 #6
0
// START 수신 이벤트
func CallbackStart(af *at.AtFrame) bool {
	ad.Println("callback start")
	js.SetJEUStateStarting(af.GetId())

	wg := sync.WaitGroup{}
	wg.Add(2)

	go ThreadWebConnRS232Rx(&wg)
	go ThreadWebConnRS232Tx(&wg)

	ad.Println("----------------++ before wait")
	wg.Wait()
	ad.Println("----------------++ after wait")

	js.SetJEUStateRun(af.GetId())

	return false
}
예제 #7
0
// START 수신 이벤트
func CallbackStart(af *at.AtFrame) bool {
	ad.Println("callback start")
	js.SetJEUStateStarting(af.GetId())

	ThreadCheckMsgRun = false
	go ThreadCheckMsg()
	time.Sleep(time.Millisecond)

	for {
		time.Sleep(time.Millisecond)
		if ThreadCheckMsgRun {
			break
		}
	}

	js.SetJEUStateRun(af.GetId())

	return false
}
예제 #8
0
// CALL 수신 이벤트
func CallbackCall(af *at.AtFrame, data interface{}) bool {

	af.SendAck(nil)
	return false
}