1

在文档中,我们有以下命令。

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
4

1 回答 1

1

它们可与任何蓝牙或附加硬件配件配合使用。您只需要从制造商处获取协议文档。演示打印到迷你蓝牙打印机。

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

于 2013-06-05T20:13:24.403 回答