本文整理匯總了Golang中cn/agree/utils.Debug函數的典型用法代碼示例。如果您正苦於以下問題:Golang Debug函數的具體用法?Golang Debug怎麽用?Golang Debug使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Debug函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReadData
func (p *IdcProtocol) ReadData(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("received Idccard ReadData request,arg is : %+v", *arg)
f, a, err := getIDCImpl()
if err != nil {
utils.Error("get Idc impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end Idc ReadData request")
return nil
}
defer MarkDeviceIDLE(IDR)
s, err := f.ReadData(a, arg.Timeout)
if err != nil {
utils.Error("invoke Idccard read error:%s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = ""
res.ResMsg = string(s)
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ErrMsg = ""
res.ResMsg = string(s)
utils.Debug("IdcProtocol ReadData success")
}
utils.Debug("end Idccard ReadData request")
return nil
}
示例2: GenARQC
//從ic卡獲取arqc
func (p *IcProtocol) GenARQC(r *http.Request, arg *JsonICInputAgr, res *JsonResponse) error {
utils.Debug("received iccard GenARQC request,arg is :%+v", *arg)
var out []byte
f, a, err := getICImpl()
if err != nil {
utils.Error("get ic impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end ic GenARQC request")
return nil
}
defer MarkDeviceIDLE(IC)
out, err = f.GenARQC(a, arg.Timeout, []byte(arg.TagList), []byte(arg.LpicAppData))
if err != nil {
utils.Error("invoke iccard GenARQC error:%s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = string(err.Error())
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ResMsg = string(out)
utils.Debug("received GenARQC read")
}
utils.Debug("end iccard GenARQC request")
return nil
}
示例3: CtrScriptData
func (jst *STICCard) CtrScriptData(pin *driverlayer.DriverArg, timeout int, taglist []byte, lpicappdata []byte, arpc []byte) ([]byte, error) {
utils.Debug("receive STICCard CtrScriptData request")
var term_type int = 0
var func_id int = 2
var buf_size int = 4096
var func_arg int = 4
t := make([]byte, 4096)
tty_name := make([]byte, 1)
tty_name[0] = 0
var func_arg_pointer []*byte
func_arg_pointer = make([]*byte, 4)
if taglist == nil || len(taglist) == 0 {
taglist = tty_name
}
if lpicappdata == nil || len(lpicappdata) == 0 {
lpicappdata = tty_name
}
if arpc == nil || len(arpc) == 0 {
arpc = tty_name
}
porttype, port, _ := driverlayer.GetPortDescription(pin.Port)
switch porttype {
case "USB":
func_arg_pointer[0] = &([]byte("U"))[0]
case "COM":
func_arg_pointer[0] = &([]byte("C"))[0]
}
//taglist
func_arg_pointer[2] = &lpicappdata[0]
func_arg_pointer[1] = &taglist[0]
func_arg_pointer[3] = &arpc[0]
r, _, _ := dllinterop.CallProc(jst.read, uintptr(term_type), uintptr(unsafe.Pointer(&tty_name[0])),
uintptr(port), uintptr(timeout), uintptr(func_id),
uintptr(func_arg), uintptr(unsafe.Pointer(&func_arg_pointer[0])), uintptr(unsafe.Pointer(&t[0])), uintptr(buf_size))
if int(r) == 0 {
var empocc int
empocc = utils.IndexByteRune(t, 0, 1)
if empocc != -1 {
t = t[0:empocc]
}
empocc = utils.IndexByteRune(t, '|', 2)
if empocc != -1 {
t = t[empocc+1 : len(t)]
}
utils.Debug("end STICCard GenARQC request ,data [%s]", string(t))
return t, nil
} else {
utils.Error("end STICCard GenARQC request error %s", int(r))
return nil, errors.New(fmt.Sprintf("%d", int(r)))
}
}
示例4: PrintEx
//add by yangxiaolong
func (p *Pr2Protocol) PrintEx(r *http.Request, arg *JsonPr2InputAgr, res *JsonResponse) error {
utils.Debug("received pr2 print request,arg is : %+v", *arg)
f, s, err := getPr2Impl()
if err != nil {
utils.Error("get pr2 impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end pr2 print request")
return nil
}
defer MarkDeviceIDLE(PR2PRT)
f.BeginPrintJob(s, 20)
defer f.EndPrinterJob()
//debug by jinsl
//f.Init()
f.SetTop(10)
f.SetLeftMargin(2)
f.OutputString(arg.Con)
f.EjectPaper()
res.ResMsg = "成功"
res.ErrMsg = "0"
utils.Debug("end pr2 print request")
return nil
}
示例5: PowerOff
//下電
func (p *IcProtocol) PowerOff(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("received iccard PowerOff request,arg is :%+v", *arg)
f, a, err := getICImpl()
if err != nil {
utils.Error("get ic impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end ic PowerOff request")
return nil
}
defer MarkDeviceIDLE(IC)
err = f.PowerOff(a, arg.Timeout)
if err != nil {
utils.Error("invoke iccard PowerOff error:%s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = ""
res.ResMsg = string(err.Error())
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ErrMsg = ""
utils.Debug("received PowerOff read")
}
utils.Debug("end iccard PowerOff request")
return nil
}
示例6: Readonce
func (p *PinProtocol) Readonce(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("received pin readonce request,arg is : %+v", *arg)
f, a, err := getPinImpl()
if err != nil {
utils.Error("get pin impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end pin readonce request")
return nil
}
defer MarkDeviceIDLE(PIN)
s, err := f.Readonce(a, arg.Timeout)
if err != nil {
utils.Error("invoke pin Readonce error: %s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = err.Error()
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ResMsg = string(s)
utils.Debug("pin Readonce request success,reteive data %s", string(s))
}
utils.Debug("end pin readonce request")
return nil
}
示例7: ReadCardNo
//調用winscard.dll實現
func (jst *ICGeneral) ReadCardNo(pin *driverlayer.DriverArg, timeout int) ([]byte, error) {
utils.Debug("receive ICGeneral ReadCardNo request")
cardno := make([]byte, 100)
errmsg := make([]byte, 300)
var len = 100
r, _, _ := dllinterop.CallProc(jst.readcard, uintptr(timeout), uintptr(unsafe.Pointer(&cardno[0])),
uintptr(unsafe.Pointer(&len)), uintptr(unsafe.Pointer(&errmsg[0])))
if int(r) == 0 {
utils.Debug("reteive card no %s", string(cardno[0:len]))
cardno = cardno[0:len]
for i, v := range cardno {
if v == 0x3D {
cardno = cardno[0:i]
break
}
}
utils.Debug("end ICGeneral ReadCardNo request")
return cardno, nil
} else {
utils.Debug("end ICGeneral ReadCardNo request")
return nil, errors.New(string(errmsg))
}
}
示例8: Read
func (p *MsfProtocol) Read(r *http.Request, arg *JsonGeneralReadInputAgr, res *JsonResponse) error {
utils.Debug("received MsfProtocol read request,arg is : %+v", *arg)
f, a, err := getMSFImpl()
if err != nil {
utils.Error("get msf impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end MsfProtocol Read request")
return nil
}
defer MarkDeviceIDLE(MSF)
s, err := f.Read(a, arg.Readtype, arg.Timeout)
if err != nil {
utils.Error("invoke msf read error:%s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ResMsg = string(s)
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ResMsg = string(s)
utils.Debug("MsfProtocol read success %s", string(s))
}
utils.Debug("end MsfProtocol read request")
return nil
}
示例9: MatchFinger
func (p *FinProtocol) MatchFinger(r *http.Request, arg *JsonFingerMatchInputAgr, res *JsonResponse) error {
utils.Debug("received FinProtocol MatchFinger request,arg is : %+v", *arg)
f, a, err := getFingerImpl()
if err != nil {
utils.Error("get fin impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end fin GetValidateFg request")
return nil
}
defer MarkDeviceIDLE(FP)
s := f.MatchFinger(a, arg.Timeout, []byte(arg.Reg), []byte(arg.Vad))
if s >= 0 {
utils.Debug("match finger success")
} else {
utils.Debug("match finger error")
}
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ErrMsg = ""
if s >= 0 {
res.ResMsg = "true"
} else {
res.ResMsg = "false"
}
utils.Debug("end FinProtocol MatchFinger request")
return nil
}
示例10: RunPr2Engine
func RunPr2Engine(s string, pr2 driverlayer.IPr2Print, pin *driverlayer.DriverArg) error {
var pc PrintCurState
pf, e := ParserPrintXml(s)
if e != nil {
utils.Error("parse xml file error %s", e.Error())
} else {
utils.Info("parse xml file success")
}
ps := pf.S
pi := pf.V
pc.BottomMargin = ps.ps.Bottommargin
pc.LeftMargin = ps.ps.Leftmargin
pc.PageHeight = ps.ps.Height
pc.PageWidth = ps.ps.Width
pc.TopMargin = ps.ps.Topmargin
pc.RightMargin = ps.ps.Rightmargin
pc.CurX = 0
pc.CurY = 0
pc.CurPage = 1
pc.Flags = 0
pc.LineInterval = ps.ps.LineInterval
pc.ColInterval = ps.ps.ColInterval
RecurCalcExtent(pi, &pc)
utils.Info("RecurCalcExtent success")
fl := GeneratePrintLine(pi)
utils.Debug("begin print printline----------------------------")
PrintPrintLine(fl)
utils.Debug("end print printline----------------------------")
pr2.BeginPrintJob(pin, 20)
defer pr2.EndPrinterJob()
RunRealPrinter(ps, fl, pr2)
return nil
}
示例11: StartEstimate
func (p *PingjiaProtocol) StartEstimate(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("received PingjiaProtocol StartEstimate request,arg is : %+v", *arg)
f, a, err := getPingjiaImpl()
if err != nil {
utils.Error("get Pingjia impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end fin StartEstimate request")
return nil
}
defer MarkDeviceIDLE(PINGJIA)
s, err := f.StartEsitimate(a, arg.Timeout)
if err != nil {
utils.Error("invoke StartEstimate read error: %s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = err.Error()
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ResMsg = string(s)
utils.Debug("Pingjia StartEstimate request success,reteive data %s", string(s))
}
utils.Debug("end PingjiaProtocol StartEstimate request")
return nil
}
示例12: GetValidateFg
func (p *FinProtocol) GetValidateFg(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("received FinProtocol GetValidateFg request,arg is : %+v", *arg)
f, a, err := getFingerImpl()
if err != nil {
utils.Error("get fin impl error: %s", err.Error())
res.Code = driverlayer.DEVICE_IN_USE
res.ErrMsg = err.Error()
utils.Debug("end fin GetValidateFg request")
return nil
}
defer MarkDeviceIDLE(FP)
s, err := f.GetValidateFg(a, arg.Timeout)
if err != nil {
utils.Error("invoke GetValidateFg read error: %s", err.Error())
res.Code = driverlayer.DEVICE_OPER_ERROR
res.ErrMsg = err.Error()
} else {
res.Code = driverlayer.DEVICE_OPER_SUCCESS
res.ResMsg = string(s)
utils.Debug("fin GetValidateFg request success,reteive data %s", string(s))
}
utils.Debug("end FinProtocol GetValidateFg request")
return nil
}
示例13: GetUsableDevice
//獲取所有運行設備
func (p *DebugProtocol) GetUsableDevice(r *http.Request, arg *JsonGeneralInputAgr, res *JsonResponse) error {
utils.Debug("%s", "received DebugProtocol GetUsableDevice request")
var buf bytes.Buffer
rad.Execute(&buf, getAllDevice())
utils.Debug("get all runnable device: %s", buf.String())
res.ResMsg = buf.String()
utils.Debug("%s", "end DebugProtocol GetUsableDevice request")
return nil
}
示例14: ChanageToIBM
func (jst *OkiPrinter) ChanageToIBM() error {
utils.Debug("OlevittePrinter received ChanageToIBM request")
s, _ := hex.DecodeString("1B5E30")
utils.Debug("OlevittePrinter send ChanageToIBM pi %x", s)
if jst.checkJobInPrint() {
return driverlayer.WriteData(jst.w, s)
} else {
return PR2NOTINJOB
}
}
示例15: Init
//打印機初始化
func (jst *OkiPrinter) Init() error {
utils.Debug("OlevittePrinter received initPrinter request")
s, _ := hex.DecodeString("1042")
utils.Debug("OlevittePrinter send initPrinter pi %x", s)
if jst.checkJobInPrint() {
return driverlayer.WriteData(jst.w, s)
} else {
return PR2NOTINJOB
}
}