Other ways to pass parameters to Fota MIDlet | Telit Cinterion IoT Developer Community
April 1, 2016 - 1:57am, 2505 views
The Fota sample retrieves the parameters ( such as path, apn) via a SMS. What are the alternatives to pass those parameters to the MIDlet? Our device talks to the modem via serial interface. So, I would like to pass those parameters to the MIDlet via the serial port, instead of SMS. So, is it possible to somehow pass the parameters to the MIDlet via the serial port? or "AT command"?
The FOTA MIDlet is just an example. Of course it would be possible to communicate with the MIDlet over serial interface and pass some parameters. You would need to implement some communication over serial: open the serial port in the MIDlet and listen for incoming data. Then you would need to implement some text protocol over serial. It might even look similar to SMS protocol for simplicity. Other possibility could be to implement some configuration file for the FOTA MIDlet and load it to the module's file system over serial interface with SFSA command for example. You could also add some parameters to the jad file and the MIDlet could read these parameters (but it could not change them).
Do you have any example of communicating over serial port?
We have been thinking about implementing the configure file. However, we have a concern about it. Our device can write (1st write) to a file in the modem's FFS; then the MIDlet can clear the file (2nd write) as soon as it consumes the file. In a corner case, both writes can happen at the same time. What will happen if "SFSA write command" and the MIDlet try to write the same file at the same time? Java can lock a file when it is writting. Can the "AT" command lock a file when it is writting?
The simple example for communication over serial you can find in "rs232demo" example application that is available on "install CD" together with all the software needed for development.
This is an interesting question about the SFSA and Java writing the same file. I think that some testing would be needed, this scenario might not be described anywhere. Anyway if FOTA would be the only functionality of the MIDlet, it can be started by external app only for the purpose of firmware update after the file is loaded to the module. There can be also multiple files used instead of one.