(6) OBEX application-file transfer
In terms of mobile data transmission, the basic OBEX applications are divided
L file transfer
L IrMC Synchronization
File transmission can be subdivided into the following basic operations:
L initialize the connection
L disconnect
L set the path
L obtain directory information
L create a directory
L upload and download files
L delete files or empty directories
I designed the OBEX class in my software, which contains all the above basic operations. In addition, for the special characteristics of the M55 server, the function of renaming, obtaining disk space information, moving and copying files is designed. For more information, see source code.
The following describes the details of each operation.
L initialize the connection
The initial connection includes a series of processes that enable the mobile phone to enter the OBEX status and then send the Connect command. The specific process is shown in the following figure.
AT & AElig; AT ^ SQWE = 0 & AElig; AT ^ SQWE = 3 & AElig; Connect to Folder-Listing Service
AT ^ SQWE = 0 and AT ^ SQWE = 3 are hidden AT commands specific to Siemens, and are not even mentioned in the official AT instruction set. The function is to initialize the mobile phone-to-OBEX mode.
Send the Connect command to confirm the parameters such as Max Packet Length after receiving the response from the mobile phone. Connect to the Folder-Listing Service to perform file operations. If IrMC Synchronization is required, Connect to the IrMC Sync Service after Connect. The mobile phone enters the synchronization mode immediately and all applications exit.
In my program, I first use the AT command to determine the current work of the mobile phone. If it times out, I try to send ++ and wait for 1 second so that the mobile phone will exit from the normal OBEX status. Then, send AT here, and then perform file operations. Otherwise, an error is thrown.
L disconnect
Here, the disconnection means to exit from OBEX mode to the AT State. In the AT command, send three 0x2B consecutively and wait for more than one second to exit the data mode and enter the regular AT Mode.
L set the path
Set the path using the SetPath operation in the program. You can design two styles of process: absolute path and relative path.
For mobile phones, I have proved that using absolute paths is easier and more accurate than using relative paths, but less efficient, especially in the case of multi-layer directories. Because the mobile phone does not return the current path, it is difficult to control the relative path, and only through program control, it is very prone to errors. Therefore, we recommend that you use absolute paths.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.