在文档中我们有以下命令。
command mergAccessoryRead pNameAndProtocol,pLength,pCallcackHandler
command mergAccessoryWrite pNameAndProtocol,pData,pCallcackHandler
它们只能与打印机一起使用还是可以普遍使用?例子?
更新 2:我卡在 mergAccessoryOpenSession 上。我想这个案子没有开庭。
这是我当前的代码。
global pNameAndProtocol
global pData
on preopenstack
put "xxxx" into pNameAndProtocol
put "get xxxx" into pData
end preopenstack
command xxxx
answer pNameAndProtocol
answer pData
printDocket
end xxxx
on printDocket
try
mergAccessoryOpenSession "xxxx","sessionOpen"
answer "mergAccessoryOpenSession is called..."
catch someError
answer "An error on printDocket " &&someError
end try
end printDocket
on sessionOpen pNameAndProtocol
try
mergAccessoryWrite "xxxx","get xxxx","writeCompleted"
answer "mergAccessoryWrite is called..."
catch someError
answer "An error on sessionOpen " &&someError
end try
end sessionOpen
on writeCompleted pNameAndProtocol
try
mergAccessoryRead pNameAndProtocol,0,"readCompleted"
answer "mergAccessoryRead is called..."
catch someError
answer "An error on writeCompleted " &&someError
end try
end writeCompleted
on readCompleted pNameAndProtocol,pData
answer "Completed..."
end readCompleted
最佳答案
它们适用于任何蓝牙或连接的硬件配件。您只需要从制造商处获取协议(protocol)文档即可。该演示打印到迷你蓝牙打印机。
on printDocket
mergAccessoryOpenSession "p25i|com.bluebamboo.p25i","sessionOpen"
end printDocket
on sessionOpen pNameAndProtocol
mergAccessoryWrite pNameAndProtocol,"UfwàD"&fld "write","writeCompleted"
end sessionOpen
on writeCompleted pNameAndProtocol
mergAccessoryRead pNameAndProtocol,0,"readCompleted"
end writeCompleted
on readCompleted pNameAndProtocol,pData
if byte 5 of pData = numToByte(3) and byte 6 of pData = numToByte(0) then
answer "print complete"
mergAccessoryCloseSession pName
end if
end readCompleted
编辑
经过相当长的支持事件后,我解决了这里的问题。似乎当打开一个答案对话框时,来自外部的回调不会排队,它们只会丢失,永远不会被执行。因此,当您期待来自外部人员的回调时,不要使用答案对话框。我已经在引擎论坛上打开了这个帖子,看看是否有解决方案:http://forums.runrev.com/viewtopic.php?f=66&t=15602
关于ios - mergAccessory ios external 是否仅适用于打印机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16934680/