In the documentation we have the following commands.
command mergAccessoryRead pNameAndProtocol,pLength,pCallcackHandler
command mergAccessoryWrite pNameAndProtocol,pData,pCallcackHandler
Do they only work with printers or can they be used generally? Examples?
Update 2: I am stuck on mergAccessoryOpenSession. I think no session opened on this case.
Here's my current code.
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