Before transplantation, determine the target of the application, that is, the business model that the application may adopt. determine the content to be transplanted, whether it is the application algorithm or data structure, whether it is the business logic or the high-level network logic, or the user interface.
Another thing before porting is to determine which are platform-independent interface attributes and specific platform interface attributes. Check whether the standard library functions of C are used and whether they depend on Functions of a specific platform. It is best to encapsulate these macros and functions instead of simply replacing them. It is equally important to clarify runtime restrictions, such as memory, threads, synchronous interfaces, and byte alignment. When porting a multi-threaded application to the BREW Platform, the callback mechanism (aeecallback) is generally used ).
At the beginning of the transplantation, it is best to establish a testing environment to test the key APIs at the application porting layer and the important APIs in the application, and to provide tracking of memory and resource usage. Similar to the OEM layer, you can establish a reference implementation for the application porting layer, and implement Platform-related attributes in this application porting layer, which makes application debugging very simple in the future.
After the application porting layer is created, you need to test it in your own testing environment. First, you need to perform a unit test, run it in the simulator, and finally run the test on your mobile phone, it also detects memory usage and algorithm execution performance. After testing the application porting layer, You can integrate the independent code of the target application platform with the application porting layer. In this case, the user interface may be merged or created. The next step is to test the entire application, then authenticate (generally Commercial Test TBT), and release the transplanted application.
When porting an application on a PC to brew, you must pay special attention to the memory model. Generally, you must rewrite the algorithm and data structure and consider a separate memory distributor, pay attention to the running performance. Porting from other mobile platforms to the Brew platform may be simpler. Pay special attention to the file structure and user interface. Remember not to read and write data segments in applications during migration. Global and static variables are not recommended in brew. Note the byte alignment and high-position byte order and asynchronous communication mode. It is best to receive more compiler warnings during porting. Generally, Level 4 warnings can be used as migration errors. When defining platform-dependent interfaces and running on mobile phones, analyze the memory and CPU performance.