接續前篇,在前篇大致知道了整個CM1015掃描的flow,
搭配AAA的印出的訊息, 我們可以知道bb_soap幾個function和hpmud的呼叫關聯。
進一步搭配從hpmud_read和hpmud_write寫出的dump內容,
我們可以知道它們溝通的訊息內容。
這篇,前半段會簡單解析bb_soap和hpmud的動作,
然後這篇重點會針對bb_open進行描述,
原則上,bb_open動作知道了,我目前認為和CM1015的溝通,就大致清楚了。
bb_soap和hpmud動作:
由前一篇的幾個dump,加上bb_soap整個flow,拆解對照後,可以得到下面的動作流程:
- bb_open
- hpmud_channel_open()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_close()
- bb_start_scan
- hpmud_channel_open()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_write()
- 這裡看AAA訊息,中間有摻雜許多function動作,甚至bb_get_parmameters呼叫時,都還有read動作,目前相當懷疑下面的read是在額外的thread處理的
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- bb_get_parameters
- bb_get_parameters
- bb_end_page
- hpmud_channel_close()
- bb_end_scan
- hpmud_channel_open()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_write()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_read()
- hpmud_channel_close()
- bb_close
- bb_unload
bb_open是第1個關卡,裡面包含了完整的open/write/read/close動作,
下段開始,我們就進入本篇主題,將bb_open內容列出並解析。
bb_open解析:
前面我們得知,bb_open內包含了2個write,4個read,這邊我們按順序列出內容:
write:
cat hpmud_write_channel_1.dump
POST / HTTP/1.1 Host: http:0 User-Agent: gSOAP/2.7 Content-Type: application/soap+xml; charset=utf-8 Transfer-Encoding: chunked Connection: closecat hpmud_write_channel_2.dump
19E <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wscn="http://tempuri.org/wscn.xsd"><SOAP-ENV:Body><wscn:GetScannerElements></wscn:GetScannerElements></SOAP-ENV:Body></SOAP-ENV:Envelope> 0
read:
cat hpmud_read_channel_1.dump
HTTP/1.1 200 OK Server: gSOAP/2.7 Content-Type: application/soap+xml; charset=utf-8 Transfer-Encoding: chunked Connection: close
cat hpmud_read_channel_2.dump
7CB 1.1 200 OK Server: gSOAP/2.7 Content-Type: application/soap+xml; charset=utf-8 Transfer-Encoding: chunked Connection: close
cat hpmud_read_channel_3.dump
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wscn="http://tempuri.org/wscn.xsd"><SOAP-ENV:Body><wscn:ScanElements><ScannerConfiguration><DeviceSettings><FormatSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eDocumentFormat" SOAP-ENC:arraySize="3"><item>scanDIB</item><item>scanJFIF</item><item>scanMMRf</item></FormatSupported><CompressionSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eCompressionType" SOAP-ENC:arraySize="3"><item>scanNoCompression</item><item>scanJPEG</item><item>scanMMR</item></CompressionSupported><JPEGQualityFactorSupported>false</JPEGQualityFactorSupported><ContentSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eDocumentType" SOAP-ENC:arraySize="4"><item>scanAuto</item><item>scanText</item><item>scanMixed</item><item>scanPhoto</item></ContentSupported><DocumentSizeAutoDetectSupported>true</DocumentSizeAutoDetectSupported></DeviceSettings><Platen><ColorSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eColorEntryType" SOAP-ENC:arraySize="4"><item>scanBlackandWhite1</item><item>scanGrayScale8</item><item>scanRGB24</item><item>scanRGB48</item></ColorSupported><PlatenMinimumSize><DimensionsWidth>500</DimensionsWidth><DimensionsHeight>300</DimensionsHeight></PlatenMinimumSize><PlatenMaximumSize><DimensionsWidth>8500</DimensionsWidth><DimensionsHeight>11690</DimensionsHeight></PlatenMaximumSize><PlatenOpticalResolution><ResolutionWidth>1200</ResolutionWidth><ResolutionHeight>1200</ResolutionHeight></PlatenOpticalResolution></Platen></ScannerConfiguration><ScannerStatus><ScannerCurrentTime>0001-01-01T01:01:01Z</ScannerCurrentTime><ScannerState>scanIdle</ScannerState><ActiveCondition>scanNone</ActiveCondition></ScannerStatus></wscn:ScanElements></SOAP-ENV:Body></SOAP-ENV:Envelope>
cat hpmud_read_channel_4.dump
0 ersion="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wscn="http://tempuri.org/wscn.xsd"><SOAP-ENV:Body><wscn:ScanElements><ScannerConfiguration><DeviceSettings><FormatSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eDocumentFormat" SOAP-ENC:arraySize="3"><item>scanDIB</item><item>scanJFIF</item><item>scanMMRf</item></FormatSupported><CompressionSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eCompressionType" SOAP-ENC:arraySize="3"><item>scanNoCompression</item><item>scanJPEG</item><item>scanMMR</item></CompressionSupported><JPEGQualityFactorSupported>false</JPEGQualityFactorSupported><ContentSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eDocumentType" SOAP-ENC:arraySize="4"><item>scanAuto</item><item>scanText</item><item>scanMixed</item><item>scanPhoto</item></ContentSupported><DocumentSizeAutoDetectSupported>true</DocumentSizeAutoDetectSupported></DeviceSettings><Platen><ColorSupported xsi:type="SOAP-ENC:Array" SOAP-ENC:itemType="xsd:eColorEntryType" SOAP-ENC:arraySize="4"><item>scanBlackandWhite1</item><item>scanGrayScale8</item><item>scanRGB24</item><item>scanRGB48</item></ColorSupported><PlatenMinimumSize><DimensionsWidth>500</DimensionsWidth><DimensionsHeight>300</DimensionsHeight></PlatenMinimumSize><PlatenMaximumSize><DimensionsWidth>8500</DimensionsWidth><DimensionsHeight>11690</DimensionsHeight></PlatenMaximumSize><PlatenOpticalResolution><ResolutionWidth>1200</ResolutionWidth><ResolutionHeight>1200</ResolutionHeight></PlatenOpticalResolution></Platen></ScannerConfiguration><ScannerStatus><ScannerCurrentTime>0001-01-01T01:01:01Z</ScannerCurrentTime><ScannerState>scanIdle</ScannerState><ActiveCondition>scanNone</ActiveCondition></ScannerStatus></wscn:ScanElements></SOAP-ENV:Body></SOAP-ENV:Envelope>
由上述可以知道下列資訊:
- 傳送時
- 傳送的是SOAP格式的HTTP + XML,中間會帶後續資料長度的神秘HEX數值
- 接收時
- 第1條是SOAP的HTTP
- 第2條看起來,內容只有神秘HEX數值,其他應該只是buffer沒清除
- 第3條是SOAP的XML,也就是實際事務機回應的內容
- 第4條看起來,內容只是神秘HEX數值0,標示後面沒資料,同樣的,buffer沒清除
內容我沒有細看,
粗淺看起來,事務機回覆的內容應該是描述事務機的能力,和支援的項目、格式。
傳送部份看起來只是制式化的訊息,應該是不用特別處理,
要掃描時,固定按這個訊息送即可,應該不用特別處理。
至於回覆的資料要不要parse,目前我還不清楚,可能要看SANE需不需要這些資訊。
結論:
bb_open看起來,應該就跟hello沒啥不同,
大致就是跟事務機通知一下,取得事務機狀態,
確定事務機目前可以準備掃描工作而已。
傳遞的訊息雖然是XML,但應該都是制式化的,
不用特別parse處理,應該都是千篇一律。
總之,bb_open就是按上述訊息丟,大概確定收到訊息和上面差不多即可。
沒有留言:
張貼留言