コード例 #1
0
ファイル: kvmgeneral.go プロジェクト: kity-xu/xuxiaodong
func (jst *KVMGeneral) InnSyncOuter(pin *driverlayer.DriverArg, timeout int) error {
	utils.Debug("KVMGeneral received InnSyncOuter request")
	s, _ := hex.DecodeString("fa5a1101000066")
	b, e := driverlayer.WritePortAndReadWithLen(pin.Port, pin.Baud, s, 0, timeout, nil)
	if e != nil {
		return e
	} else {
		utils.Debug("KVMGeneral InnSyncOuter data %s,begin to process", b)
		return nil
	}
}
コード例 #2
0
ファイル: stpingjia.go プロジェクト: kity-xu/xuxiaodong
func (jst *STPingjia) StartEsitimate(pin *driverlayer.DriverArg, timeout int) (string, error) {
	utils.Debug("STPingjia received StartEsitimate request")
	s, _ := hex.DecodeString("1b5b3452")
	t, _ := hex.DecodeString("1b5b3443")
	utils.Debug("STPingjia send StartEsitimate pi %x", s)

	b, e := driverlayer.WritePortAndReadWithLen(pin.Port, pin.Baud, s, 3, timeout, t)
	if e == nil {
		utils.Debug("received data %x", b)
	}
	switch string(b) {
	case "B1F":
		return "非常满意", nil
	case "B2F":
		return "满意", nil
	case "B3F":
		return "不满意", nil
	case "":
		return "超时", PINGJIARESULT_EXCEED_MAXTIME
	}
	utils.Error("unexpected pingjia value %s", string(b))
	return "", PINGJIARESULT_NOT_FORMULAED
}