memobirdforgo

package module
v0.0.0-...-5b795a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 6 Imported by: 0

README

memobirdforgo——又一个go语言咕咕机的开发类

一.本工具类实现的功能

1.打印纯文本内容

2.通过base64打印图片

3.通过文件打印图片

二.使用步骤

1.在咕咕机开放普通获取ak(https://open.memobird.cn/)

2.安装本工具类所使用的依赖

github.com/doumadou/mahonia
github.com/imroc/req/v3

3.获取你的你的设备api

如果你不知道可以使用api获取(格式:http://open.memobird.cn/home/setuserbind?ak=你的ak&timestamp=时间戳&memobirdID=设备编号&useridentifying=一个随机数

4.初始化接口

memobird := newmemobirdapi("你的ak", "你的设备编号", "你的设备api")

5.开始打印

//打印纯文本
Result:=memobird.printpaperbytext("你要打印的文字")
//打印base64编码的图片
Result:=memobird.getSignalBase64Pic("你要打印图片的base64")
//打印以文件存储的图片
Result:=memobird.printpaperbyimgfile("你要打印图片的路径")

6.查询打印结果

(这个功能官方api炸了,正在等待官方修复)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Text

func Text(text string) string

转换为gbk的base64编码(官方要求)

Types

type SignalBase64PicResultstruct

type SignalBase64PicResultstruct struct {
	Showapi_res_code  int    `json:"showapi_res_code"`
	Showapi_res_error string `json:"showapi_res_error"`
	Result            string `json:"result"`
}

获取点位图结果的结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL