-
Notifications
You must be signed in to change notification settings - Fork 104
Add map support #78
Comments
Hi Luca! Please, take a look at this "GetCleanLogs" command: The result will be like:
When I run the Clean command I can see that the deebot is getting some full png image, so I hope the imageUrl can be called also for live maps.
Hope this help! P.S: I have an old Android 5 device and I can get some info from HTTPS traffic, but I didn't find anything more at the moment... I'll let you know otherwise. |
Hi, thank you @Ligio , meanwhile I found that the "PullMP" command result, the one used to retrieve the map piece image, is returned directly by the REST API "devmanager.do" and is not received using MQTT or XMPP protocols. Trying to invoke the REST API manually using Postman, I found that the raw json body contains a well-formed base64 text. This is the result returned by the rest API for an empty map piece (index 0)
Using the right base64 text, which in turn produces a well-formed lzma compressed stream, I understood that the map piece binary data is a list of pixels encoded as following:
The resolution of the piece is the one returned in the main map info metadata (n my case 100x100 = 10000 pixels). So, it seems that the issue about the base64 text is in the sucks' or python's logic when parsing the raw/json REST response. I will update the ticket as soon as I found where it is... really can't understand who it is and why it should alters the text... |
I found the culprit of the malformed base64 text: The same is done for MQTT and REST communications implementation of the pull request #63:
So, what happens is that sucks convert all non integer properties of a command response to snakecase (ref: https://github.com/okunishinishi/python-stringcase ) and, for unknown reason, the first uppercase character is not prefixed with an underscore. IMHO it is not so much correct that every text is converted to a snakecase... if it is done to map return message event codes to event handler functions, it should be responsibility of the main handler function to convert just the event code to a snakecase, or if it is done to handle other attributes in other handling functions, it should be responsibility of them to properly sanitize (converting to snakecase or other) needed attributes. Anyway, I was able to recover the original base64 text decompressing it using the following code:
|
@lukakama - Thanks for this. I haven't reviewed the code base to see why it was done this way originally, but for my PR and changes I tried to mirror the existing code - hence my fork/PR showing the same issues. If you have any ideas to address this in the code I am happy to accept a PR on my fork, otherwise when I get some spare cycles I may take a look at this myself. |
I'm trying to add the map image pull support for vacuum having mapping capability such as 900 serie.
Probably the request is more related to bmartin5692 and his fork / pull request #63 .
By far I was able to understand how the map is managed and how it is retrieved.
For management, the full map is splitted in a grid x * y, and the app pull the image for each grid piece at a time.
The protocol used to retrieve it is the following:
These are what I was able to get with sucks on my Ozmo 900:
"GetMapM" (8x8 grid, 64 pieces, 100x100 resolution) result message:
{'i': '1839263381', 'w': '100', 'h': '100', 'r': '8', 'c': '8', 'p': '50', 'm': '1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1040846638,609882317,3179079115,1295764014,1295764014,1295764014,1295764014,1295764014,71766224,3547694766,3759498071,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014,1295764014', 'event': 'map_m'}
"PullMP" for index 0 (probably an empty image, as they should be my first 26 grid pieces) result message:
{'ret': 'ok', 'i': '1839263381', 'p': 'x_q_a_a_b_a_a_q_jw_a_a_a_a_bv/f//o7f/_rz5_i_f_x_i5_y_v_g4kijmo4_y_h+e7k_ho_l_t_l8_u6_p_a_f_ls_x7_jhrz0_kg_a=', 'event': 'pull_m_p'}
However, this is where I'm currently stuck: the image data ("p" attribute) retrieved with sucks does not seem to be a valid base64 text, as it contains unhallowed "_" characters. Also, it does not contain any uppercase character, which is strange for a text base64 encoded...
Moreover, by performing some tests I was able to produce a partial valid lzma data, by converting each character before an underscore to uppercase and removing the underscores, which produce a valid lzma header (first 5 bytes) once decoded into a byte array (respecting also some check performed by the Android app on hard coded values on such first 5 bytes), but the remaining portion of the lzma compressed data results to be corrupted and cannot be decompressed.
I'm worrying if there is something wrong with the retrieval of the command result message, maybe due some configuration to be fine tuned at lower lever, or for the api used to send the command and/or the channel used to retrieve the result message (MQTT vs XMPP), considering that the Android app does not seems to apply any transformation on the base64 text of the result message, which is simply decoded using the standard android Base64 utility class, which I also tested that does not decode correctly the base64 text that I'm able to retrieve using sucks.
Unfortunately, I was not able to setup any tool to trace the data sent and received from the Android app and the vacuum, as latest versions of Android do not allow anymore the usage of a proxy to decrypt https traffic, and the vacuum instead does not seem to use xmpp (or I was unable to setup the xmpp proxy correctly).
Do anyone have some clue or have some hint on how or what to try in order to be able to retrieve a well-formed base64 text for the lzma compressed image data ? What could I check to see what protocol is used by sucks? Is there a way to force the use of MQTT or XMPP by code for specific commands?
Thanks
The text was updated successfully, but these errors were encountered: