As mentioned above, ififo is actually a file, and shared files, that is, sharing resident data is also the easiest way for brew applications to communicate with each other. There are three data resident methods in brew: system storage, files, and databases.
System Storage refers to the method of resident data through ishell_setprefs () and ishell_getprefs. Ishell_setprefs () and ishell_getprefs () provide a method to save the data structure that contains or reads the first address of the application or class level, which is equivalent to the serialization in VC and easy to use, data is shared by the entire aee layer.
A shared directory such as shared exists on a mobile phone. All files under the shared directory can be accessed by any application (the application must have at least the File Permission ). Therefore, if a file name is specified, two or more applications can access the file to communicate with each other. The const file allows the OEM to reduce the ram load. Generally, You cannot delete or modify the const file. ifile_map () can be used to map the const file to the memory. Therefore, the const file is rarely used as a carrier for communication. The file size supported by ifilemgr_getinfo () and ifilemgr_getinfoex () cannot exceed 4 GB (earlier than brew3.x). The file name length is also limited, through ishell_getdeviceinfo (pishell, Pi ), pi-> wmaxpath, you can get the maximum length of the file name including the path.
Idatabase is a database interface. Multiple applications can share the same database. Idatabase can create and access the records in the database created and opened by idbmgr, and call idbmgr_opendatabase () to open the required database to obtain the idatabase interface. In addition, you can use the functions in idbrecord to access the fields recorded in each database. The permission level of the application must be "file" or "all" to call the function that can modify the database content.
The idatabase_createrecord () function creates a new record and adds it to the database (idbrecord_remove () is used to delete records in the database ). Each record can contain one or more fields. Each field is defined by the aeedbfield structure. When creating a record, you must first enter the aeedbfield structure array, to specify the name, type, content, and length of each field in the record. Then, call idatabase_createrecord () and provide the pointer to this array and the number of aeedbfield structures to be included as the input parameter. Idatabase_createrecord () returns a pointer to the idbrecord interface instance, which can be used to access and update record fields. When creating or updating a record, the number of fields and field type are specified for each record. All records in the given database do not have the same structure. After creating a database and adding records, you can use other idatabase functions to retrieve records from the database.