Golang at.AtFrame类(方法)实例源码

下面列出了Golang at.AtFrame 类(方法)源码代码实例,从而了解它的用法。

作者:webconnm    项目:AutoTes   
func CallbackKill(af *at.AtFrame) bool {
	ad.Println("callback kill")

	js.SetJEUStateEnding(af.GetId())

	return true
}

作者:webconnm    项目:AutoTes   
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
}

作者:webconnm    项目:AutoTes   
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
}

作者:webconnm    项目:AutoTes   
// 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
}

作者:webconnm    项目:AutoTes   
// 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
}

作者:webconnm    项目:AutoTes   
// 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
}

作者:webconnm    项目:AutoTes   
// 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
}

作者:webconnm    项目:AutoTes   
// CALL 수신 이벤트
func CallbackCall(af *at.AtFrame, data interface{}) bool {

	af.SendAck(nil)
	return false
}


问题


面经


文章

微信
公众号

扫码关注公众号