I presume you want to download customer application (DOTA I).
First you have to know how large is your new application (max. length of wpb.dwl file). Assuming you have written quite a big appli:
#define DWL_CELL_ID 10 // cell ID
#define DWL_CELL_SIZE 256000 // size of dwl cell
Of course, cell size can be adjusted dinamically, but you allways have to assure that there is enough space in AD storage. If not, use adDelete and adFormat (you will loose some data, but who cares, your primary goal is to run new features!). Subscribe your dwl cell in AD storage:
DwlCell = adl_adSubscribe(DWL_CELL_ID, DWL_CELL_SIZE);
As data for your new application are comeing, they are saved packet after packet with:
Result = adl_adWrite(DwlCell, Len, Poi);
And finally all data are here, checksum is correct, you can install new appli with:
Result = adl_adFinalise(DwlCell);
Result = adl_adInstall(DwlCell);
If anything OK (check the Result var), the modem will reset and restart with your new appli.
- Implement a protocol, which announces download will follow.
- Announcement includes length of dwl file (wpb is packed and so shorter).
- Reserve enough space in AD storage within single cell.
- Write succesive data in that single cell.
- Protocol should include simple check of downloaded data.
- If check passes, finalize cell and install software.
- When new appli restarts, it can then delete DwlCell, to make room for app data.
OS download (DOTA II) folows the same procedure, but the cell must be larger.