Events coming from the IoT Box were lost in two cases:
1. Create a listener for device 1
2. Send an action to device 1
--> If the action arrives before the listener the event is never sent
to the DB
1. Setup up two listeners for devices 1 & 2
2. After a few seconds, send two consecutive actions to devices 1 & 2
--> Everytime a longpolling request arrives, a new threading.Event
object is created. The first action sets the event, then, before the
new longpolling request arrives, the second action sets the same event,
which is overwritten once the new longpolling request arrives.
We now maintain a list of events, and when a longpolling request
arrives on the IoT Box, we make sure that all events that occured in
the last 5 seconds were received by the DB. If no events were pending,
we wait 50 seconds to check if a new one pops up.
Taskid: 2320958
X-original-commit: e3260712ce96a8d81bf807574c334d92c37c6ae4
- Split driver.py to multiple files
- Remove hw_proxy module as most of its routes were not used and
move remaingin routes to a controller in hw_drivers
- Add missing coding and license lines at the beginning of files
- Reorder imports and remove unused ones
- Rename device_id to device_identifier for clarity
- Rename screen to display for consistency
- Other minors improvements
Taskid: 1973956
X-original-commit: 841c016913a87133bf7257c62ae5f6bf7d99e06d
In Chrome 84, mixed content will be completely blocked for security
reasons ([see blog](https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html))
Other browsers will probably follow in the next months.
As IoT Boxes don't have a valid certificate before connecting to a DB,
we used mixed passive content to communicate with the boxes.
This won't be possible anymore, and we have no possible way to
communicate directly from the browser to the box.
- When an IoT Box boots without registered DB, a unique code will be
created with a validity of 5 minutes.
- This code will be shown on the customer display and printed on the
status ticket.
- The box will call a route on odoo.com and a record will be created
in odoo.com with the unique code.
- The user will have to enter the code manually in his DB to connect
to the IoT Box, the DB will then contact odoo.com to search for a
record containing the unique code. If it's found, the
`openerp.enterprise.database` will be added to the record.
- The box will then query odoo.com at regular intervals (10 seconds)
to check if a DB is linked to the code.
closesodoo/odoo#53623
Taskid: 2246535
X-original-commit: c55f12e32598a713105f3c049ac053e46ba15bb2
Related: odoo/enterprise#11421
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
When the route '/hw_drivers/box/connect' is called to connect an IoT Box to a DB,
the checkout on the branch of the DB is not performed and incompatibility can occur.
With this fix we relaunch Odoo via a parallel thread in order to be able to respond to the request...
closesodoo/odoo#52513
X-original-commit: 9aca7c464cef492c495a0c72d870b7075187dc63
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Previously, we tested the `supported` methods of all drivers
sequentially in alphabetical order of file names. If you wanted to
extend a driver, the `supported` method of your driver could never be
tested if the one of its parent was tested first.
We've now added a priority order to drivers so that by default the
extending driver will always be tested before the extended driver.
You can still do something similar to what `is_tested_last` did by
manually setting the priority of a driver to 0.
Ex: The way barcode scanners is really similar to keyboards, but still
requires a few modifications in the driver. We couldn't extend the
keyboard driver easily because the supported method of barcode scanners
had to be more strict than the one of keyboards. If the
KeyboardUSBDriver was tested first, scanners were recognized as
keyboard and didn't have all the specific features of scanners.
TaskID: 2082282
Until now, to detect new types of devices on the IoT Box, we had to
modify driver.py. If partners wanted to connect a new type of device,
they had to modify directly the files on the Box, meaning that after
each new build they had to re-apply all their modifications.
We remove the loops that detected the connected devices and replace
them by `Interfaces`. All interfaces will be loaded from the connected
Odoo instance with the corresponding drivers.
TaskID: 2082282
Exceptions were not logged correctly due to a typo in ExceptionLogger.
closesodoo/odoo#51191
X-original-commit: 9ac2ad249bddc631de9a9d587058d6109918f584
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Steps to reproduce:
- Start the IoT Box with a monitor plugged in
- Unplug the monitor
- Restart the Odoo service (i.e. connect the IoT Box to a DB)
- No devices are detected
The problem came from the fact that `tvservice -l` and `tvservice -n`
have different behaviors when a monitor is disconnected:
- `tvservice -l` still says that a device is attached
- `tvservice -n` cannot detect the name of the device so it logs an
error to stderr but still has a return value of 0 so we read an empty
string from stdout.
The `get_connected_displays` function raised an exception because the
format of the returned string was not the one we excepted. The other
loops were then not started and no devices at all were detected.
closesodoo/odoo#50839
X-original-commit: ab6ec2ab6d30a86f9741da4b1986831772004d91
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
This reverts commit 9d43308a8f6b521d3d18f7fc472303f58f56a0c3.
No one should be using MPD in production at the moment but
we'll still leave it in the buiold of the Box, just to be sure.
X-original-commit: 129101815d5846d5b53148546b19bdd791f22aac
Remove the MPD server and Six configuration from the IoT Box.
MPD will be replaced by TIM, which doesn't require the IoT Box.
closesodoo/odoo#46424
Taskid: 2188566
X-original-commit: 9d43308a8f6b521d3d18f7fc472303f58f56a0c3
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
For update correctly the route list of IoT after loading driver
we need set 'http.addons_manifest' to a empty json
Linked to 97c09e1c77284836c7c46b4e70d4f12eb48ce91b
Reboot not needed after a update
Linked to b77486753b7ae220a531ee09c529fb5eb944b0e2
Linked to 181a62cb57e143611ca1fbf0779cfd041d2a3cf8
closesodoo/odoo#46386
X-original-commit: 87b127efed97c1f6fad18d6ee6b5924a9b2c70f2
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
If IoT Box is in access point mode and a server is configured
the box try to reach the server.
But in access point mode all requests are redirected to the box
So now before return True in function 'get_odoo_server_url'
we verify if the service 'hostapd' is inactive
closesodoo/odoo#46141
X-original-commit: 365f0e384630bad16e0872d2307702fca5a4e295
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Preivously, the code of the IoT Box was retrieved from the branch that
was used during the build but the drivers were retrieved from the
connected Odoo DB. Both could be in different versions, which forced
used to make old drivers compatible with the new Box or new drivers
compatible with old versions of the Box.
All of this made it quite hard to modify the existing code, even for
new versions of the Box in master.
When connecting the IoT Box to an Odoo DB, we now retrieve the version
of Odoo that is used and checkout the Box to this branch. This means
that we can now modify the code of the Box in master without having to
worry about users using the latest build with older DBs.
Taskid: 2120749
X-original-commit: 6af5d669593a4f431d14fce08c6151932f97da82
Actual IoT Box not detect correctly Epson TM-T88v.
Now we can detect printer even if name is 'Unknow'
closesodoo/odoo#41563
Taskid: 2153108
X-original-commit: 4c7a1d7a9ba2ad0fbdd92b3a73b0d6294cb6e4a3
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
We clean the code for the MPDManager by removing useless lines and
simplifying the way we run the MPD server.
closesodoo/odoo#40892
Related: odoo/enterprise#6892
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Exceptions were logged to stderr so we couldn't see them when Odoo was
running as a service on the IoT Box. We now redirect stderr to the logger
to see track errors in the log file too.
closesodoo/odoo#41028
Taskid: 2146835
X-original-commit: 54a1919cbc37f5832ce110605c29b222c7a5bfe9
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
We now support the RPI4 which has 2 micro-HDMI outputs, while the
prvious driver only supported one display. We add support for a second
display.
Taskid: 2123511
X-original-commit: 5886c3a864c990fcd7b852baafab752e7da90494
In the latest version of Raspbian, when no display is connected to the
HDMI port, "tvservice -n" finds a display named "Unk-Composite dis".
Therefore, the `distant_display` was not created.
The MPD server was not correctly killed when the IoTBox started without
six payment terminal configured. A warning was displayed.
closesodoo/odoo#36415
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Automatically load the IoT Drivers when Odoo starts on the IoT Box or
when the connection to the Odoo instance is done.
Allow to deactivate the automatic load to avoid overriding
modifications made on the Box.
TaskID: 2009683
If no Six Payment terminal is configured, kill eftdvs if it is running.
When removing the configuration for a Six payment terminal, we just
removed the file with the configuration but we didn't stop eftdvs. The
terminal the nstayed connected to this Box even after removing the
configuration, blocking the connection to another terminal.
With this commit we add the possibility to save the db_uuid and enterprise_code on the IoT Box.
We check the current SSL certificate and if it is not authenticated or not up to date
we send a request to 'https://www.odoo.com/odoo-enterprise/iot/x509'
with the db_uuid and enterprise_code to get the certificate, key, and domain associated with the client.
The IoT Box will be accessible in HTTPS according to the following domain:
https://<ip-with-dashes>.<sub-hash>.odoo-iot.com
<ip-with-dashes> being the ip address with dashes
<sub-hash> being a subdomain assigned by Odoo to a customer
Task: 1931770
Add support for Six payment terminals.
TaskId: 1932416
Linked to odoo/enterprise#4435
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
closesodoo/odoo#33673
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Barcode scanners are now part of KeyboardUSBDriver. We also add
the possibility to change the keyboard/scanner layout from an
action. The list of available layout can be retrieved with a new
route.
`hw_scanner` has been removed. Backward compatibility is ensured
because the name of the route that is now used in community is the
same that was used previously.
TaskID: 1939455
Add MPDManager to driver.py to keep a list of connected terminals
up to date.
Add the files needed to communicate with the payment terminals:
eftdvs --> MPD server that needs to run on the IoTBox
eftapi.so --> Library to connect Odoo to the MPD server
TaskId: 1932416
ESCPOS printers are now supported as IoT Devices, just like any other
printer. We now transform the receipts to JPGs, transform these JPGs
into ESCPOS commands and send them via Cups, adding support for network
printers. Since we now print images, we can now print special
characters and therefore add support for other languages such as
Arabic.
The JPG is generated in the browser, with the help of html2canvas.
`hw_escpos` is left untouched to allow backward compatibility and
should be removed when v12 is no longer supported.
In the PoS, all the code for printing has been moved from ProxyDevice
to a separated JS file.
TaskID: 1939455
Using path such as '/dev/ttyUSB0' to connect to a serial port
makes it impossible to use the bluetooth.
We now use the locations in '/dev/serial/by-path' to connect to serial port,
which does not affect bluetooth connections
closesodoo/odoo#35302
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
The check for abstract driver classes results in some errors being logged on the iot box.
Since this check is not essential at this point, it was removed and will be reintroduced later
if needed.
closesodoo/odoo#35014
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit adds a base serial and a base serial scale iot drivers,
as well as drivers extending them for the two previously supported scales
(ADAM EQUIPMENT AZEXTRA and TOLEDO 8217).
Since just adding the new drivers creates a race condition
between the old drivers and the new, the old drivers need to be removed.
The IoT scale drivers need to be backward compatible and compatible with the community version,
so client using an IoT box with those versions can still connect a scale to the PoS.
Task: 1892412
before this commit the date of the IoT Box did not update.
With this commit we restart the service timesyncd on the IoT box
Task: 2034930
closesodoo/odoo#34789
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Before this commit the identifier integrate the BUS and port to identifiate USB devices
Now we check if there are duplicates devices before increment the identifier
For other loop we add identifier in the iot_device object
task: 1963500
closesodoo/odoo#32737
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Before this commit, we only sent the list of connected devices to
the odoo instance (thanks to `self.send_alldevices`) when a device
is newly connected. Now, we also send this list when a device is
disconnected. We also try to call this method once if multiple devices
are connected/disconnected during an iteration.
task-id 1939338
closesodoo/odoo#32678
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
With this commit it is now possible for the IoT Box
to listen on a specific port of the box to interact
with a device via TCP / IP.
We use the library 'socket' to listen on port 9000
and if a request comes on this port we create an IoT Device
When we are on HTTPS and we want to connect a box with the scan
we need to accept manually the certificate of the box.
With this commit we don't need to accept manually the certificate.
We don't have problem of mixed content if we use the onload method of Image object
So we load a image and put on parameter the token of the odoo DB to make a connection.
Improve the implementation of IoT.
Allow both-direction communication between iot box and devices.
Now a device can send its value / status as soon as it changes. Not only when he receives a request.
Now the box have only 3 routes:
/hw_drivers/action
parameter: session_id, device_id, data
used to ask at a device to make a action (take picture, make print, ect...)
/hw_drivers/event
parameter: listener
listener is a dict where you have the session_id and a list of device_id to listen
this route wait to answer that we call device_changed for a device_id with data or value
/hw_drivers/box/connect
parameter: token
used to register the box to a Odoo database
token contain the url of Odoo database and a unique number that allow the IoT Box
to connect box in the hour
task : 1906910
- Routes to get device/driver statuses from the browser
- Framework for managing and downloading drivers for devices
connected to the IoT Box
- Automatic detection of printers and cameras in the network
- Built-in detection for USB and Bluetooth LE devices and checking
if a driver matches the device
- Authentication of the box into Odoo
- Inform Odoo of the connected devices and giving them a unique
identifier so they can be called from the browser
Thanks to qle, specially for fswebcam and cups