![]() IntroductionWish to develop SMS or EMS application? What do you read from your mobile? PDU code. PDU is a format which you send to a phone to send a SMS or an EMS. You can find more in GSM 03.40.What is a PDU code and how can I decode it?Let us take a simple look at PDU code. Here I created a SMS: "Hello, my pretty world!", in my Siemens M55 mobile, and send it to 1861. I use HyperTerminal to communicate with my phone using AT Command set. First, I set my character set to Unicode: Then I set my preferred message storage to MT: At last, I read all my SMS out: I find the SMS I just created in PDU format: Now, I decode it manually: Ha-ha, now you may know more about PDU code. Let us start our program. What is the structure of my PDU Decoder?I created a must inherit class , it provides basic structure a SMS must have. For example: something relating to service center, first octet, TP_PID, and so on. In this class I provide a must override sub GetOrignalData, this help me to do further work on the orignal data from PDU code. Here are also a few of shared functions:
class, I created , , , , classes that inherit from class. How it works?I wanted it like, once you create an instance of one class with a PDU code, it decodes it immediately. So, I wrote some code in every . Take , for example: The gets original data from PDU code. This decodes a received SMS's PDU code. It is so easy to write some code like this after you read GSM 03.40. Shared function here helps me get what I want, a byte or a string or even a date. Note that when you get something from PDU code, it will be got rid of from the PDU code. This seemed like a good way after I failed to control the position of what PDU code I should get, because every time, the shared functions started from the beginning of PDU code. In EMS, I write a function to get Information Element from PDU code and a structure to store it. Maybe, my class is not the best, but it works well :). How can I use this class?If you know what the type of PDU code is, you simply create an instance of a certain type in SMS or EMS. But when you don't know the type, you use shared function to get the type. Then according to the type, create a certain instance of class, it is decoded automatically. Still don't know? Sorry for my poor English, run my program and see my code, you will know it better. Are there some bugs?Sorry, I don't find bugs when I decode PDU code from Siemens M55 mobile and Nokia 8xxx mobile, I think there will be no bugs. If you find some, please contact me. Thanks!Some useful documents and sites
Contact me and make friends with meMy email: [email protected]; [email protected]. My QQ (only in China): 38288890. My MSN: [email protected]. My homepage. My CSDN blog. In the end, thanks for using these classes! |