• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python tool to control MiaoMiaoJi / Paperang / 喵喵机

喵喵机蓝牙API By ihciah

依赖

pybluez 蓝牙API需要(树莓派上折腾这东西踩了挺多坑

twisted, pyopenssl 微信接口脚本需要

cv2, numpy 图像转换工具需要

建立连接

BtManager() 参数留空会搜索附近可用的喵喵机并连接

BtManager("69:68:63:69:61:68") 附加指定MAC会跳过搜索过程直接连接设备,更省时间

打印图像

从API看该机器只能输入二值图像进行打印,所以文本转图片是在客户端完成的。

打印的图像格式为二进制数据,每一位表示黑(1)或白(0),每行384个点。

mmj = BtManager()
mmj.sendImageToBt(img)
mmj.disconnect()

其他杂项

registerCrcKeyToBt(key=123456) 更改通信CRC32 KEY(不太懂这么做是为了啥,讲道理监听到这个包就能拿到key的)

sendPaperTypeToBt(paperType=0) 更改纸张类型(疯狂卖纸呢)

sendPowerOffTimeToBt(poweroff_time=0) 更改自动关机时间

sendSelfTestToBt() 打印自检页面

sendDensityToBt(density) 设置打印密度

sendFeedLineToBt(length) 控制打印完后的padding

queryBatteryStatus() 查询剩余电量

queryDensity() 查询打印密度

sendFeedToHeadLineToBt(length) 不太懂和 sendFeedLineToBt 有什么区别,但是看起来都是在打印后调用的。

queryPowerOffTime() 查询自动关机时间

querySNFromBt() 查询设备SN

其实还有挺多操作的,有兴趣的看着const.py猜一猜好了。

图像工具

ImageConverter.image2bmp(path) 任意图像到可供打印的二进制数据转换

TextConverter.text2bmp(text) 指定文字到可供打印的二进制数据转换

微信公众平台工具

两个小脚本,用来实现发送图片给微信公众号后自动打印。

wechat.php 用于VPS接收腾讯数据,默认只允许指定用户打印。

printer_server.py 放置于树莓派等有蓝牙的靠近喵喵机的机器上运行,可以使用tinc等建立VPN以供VPS直接访问。

吐槽

这玩意就不能增加一个多次打印的功能吗?以较低温度多次打印再走纸,应该可以实现打印灰度图的。

逆了好久的固件也没搞出来啥东西,真是菜。希望有大佬能告诉我一点人生的经验。

顺便丢两个芯片型号: NUC123LD4BN0, STM32F071CBU6,似乎是Cortex-M0。

PS: 本代码仅供非盈利用途,如用于商业用途请另请高明。

More Repositories

1

shadow-tls

A proxy to expose real tls handshake to the firewall
Rust
2,224
star
2

clean-dns-bpf

基于 Rust + eBPF 丢弃 GFW DNS 污染包
Rust
1,106
star
3

rabbit-tcp

A multi-connection TCP forwarder/accelerator
Go
495
star
4

deep-fashion-retrieval

Simple image retrival on deep-fashion dataset with pytorch - A course project
Python
230
star
5

go-shadowsocks-magic

A shadowsocks implementation in golang with Multi-connection Acceleration
Go
153
star
6

rust2go

Call Golang from Rust
Rust
147
star
7

tg_channel_bot

Fetch and push to telegram channel/user/group !
Go
99
star
8

inner-shadowsocks

Shadowsocks -> socks5 on server. (Created for providing socks5 proxy for Telegram)
Go
90
star
9

small-map

An inline SIMD accelerated hashmap designed for small amount of data.
Rust
71
star
10

mini-rust-runtime

Rust
49
star
11

google-in-docker

A google reverse proxy in docker
46
star
12

telearia2

Rust
42
star
13

socks5-forwarder

Rust
42
star
14

NAS-tools

Some configure files and scripts for NAS
Shell
40
star
15

CNN_forward

CNN(Convolutional neural network) forward code which requires little dependency(Opencv, TBB-optional) and is easy to run on Windows(using caffe's model)
C++
34
star
16

shadowsocks-with-socks-auth

Shadowsocks with socks auth
Python
33
star
17

ddns-worker

Rust
32
star
18

cloudflare-kv-proxy

Cloudflare Worker KV Proxy
Rust
29
star
19

certain-map

A typed map which can make sure item exist.
Rust
29
star
20

GFHelper

Girl Frontline Helper
Go
25
star
21

rabbit-plugin

A rabbit-tcp plugin for shadowsocks
Go
25
star
22

AndroidSMSRelay

Script to forward and send android(with root) sms using adb
Python
22
star
23

subtitle

A cli tool to download subtitles.
Python
19
star
24

OneEncrypt

A Simple and Naive Encryptor for OneDrive(已投奔OSX,弃坑了!)
C
12
star
25

singleflight-async

Rust
11
star
26

service-async

A Service like tower in async style
Rust
10
star
27

thrift-parser

Rust Thrift Parser
Rust
9
star
28

aria2-rs

Yet Another Aria2 JSON-RPC Client.
Rust
8
star
29

xbox-nginx

xbox 国内加速代理
HTML
8
star
30

simple-ddns

A Simple Dynamic DNS Server for Personal Usage
Python
8
star
31

auto-const-array

Declare a const array without specify its length
Rust
8
star
32

simple-qq-bot

A simple QQ bot (Test account: 2404865065)
Python
7
star
33

HamsterRunning

Automatically log hamsters' running data and send to weibo
Python
7
star
34

trojan-caddy-docker-compose

Dockerfile
7
star
35

wol-homekit

WakeOnLAN with HomeKit
Rust
6
star
36

stinc

Shadowsocks + tinc + chnroute in docker
Shell
5
star
37

urlshorter

网址缩短 附带便笺条功能(On SAE)
CSS
5
star
38

cookieinjector

Wireshark cookie injector for tampermonkey
JavaScript
5
star
39

byte-style-encoder

Rust
4
star
40

static-blog-image-downloader

Rust
4
star
41

douban-api-proxy

豆瓣电影搜索API代理
JavaScript
4
star
42

must-done

An experimental Future that is guaranteed to be done
Rust
3
star
43

classifier-mt

Caffe classifier with multi-thread
C++
2
star
44

oj

做过的oj题目 顺手发上来
C++
2
star
45

bounded-pool

Rust
2
star
46

dorm_tools

寝室自用小工具
Python
1
star
47

XV6-OS

XV6 in OS_class
C
1
star
48

fdcard-captcha

复旦一卡通网站验证码识别(简易SVM
Python
1
star
49

pj

sww的PJ!
C#
1
star
50

MiniJava

MiniJava前端 编译原理Project
HTML
1
star
51

nas-bot

自用Telegram Bot
Go
1
star
52

FudanPTAutoDownloader

A script for auto download torrents of PT@Platform
Python
1
star
53

docker-ocserv

Shell
1
star
54

xk-database

某科学的张江大学选课系统-汪卫的数据库PJ
CSS
1
star