Source code for GPRS measurement using ril.h? - Windows Mobile Development and Hacking General

Does anybody have an easy example using RILL to see GPRS band strength.
Thanks.

I include some code I developed for this. However the calibration for this is for XDA I. For XDA II this goes too high values.
If you want to have a hack, look at:
http://forum.xda-developers.com/viewtopic.php?p=11643&highlight=#11643
I had a quick look at the xda-developers ril API, and I think this now passes the max and min possible signal strength, so it would be accurate on any device. Maybe somebody else can confirm this.
Therefore, my function to return a percentage should be something like:
static double dValue;
dValue = (double)data->SignalQuality;
dValue -= dLo;
dValue /= (dHi - dLo);
dValue *= 100;
m_dwSigQuality = (DWORD)dValue;
Hope this is of some use, sorry it's not complete.
Ben.

I have seen the topic you say before I post this
The problem is that I don't know how to use the info. that comes with the post you say.

If you look at the work completed by the xda-developers, they provided a program which shows how RIL works. Their example, last time I looked, shows how to start RIL, and listened for incomming SMS messages. To start with, find this code and add the rill calls to your program.
Find the function called 'ResultCallback'. This is called by RIL when something happens which your program may want to know about. Add to this the code I posted, starting:
if (hrCmdID == m_dwSigQualityID) {
From your own program, you now call my function containing:
m_dwSigQualityID = RIL_GetSignalQuality(g_hRil);
If this works, this will return the percentage signal strength.
Although as I said, this works well on XDA I, but needs a re-calibration for XDA II and more recent work on RIL.
Ben.

It works!
If the GPRS is connected it returns 69%, but if GPRS is not connected it returns a GSM value.
Any idea of how to make an easy dll to use this value in other program?
Thanks.

Very glad it works! Sorry about the 69%. This is fixed with the XDA II.
As far as an easy .dll, I don't know. (Or a nice easy class) Somebody here does I am sure....
Ben

Can you please attach a working ResultCallback code for the signal stregth?
I get 603% on my XDA2...
I think i did something wrong.
Thanks, Patrick

Hi,
benclewett said:
If you look at the work completed by the xda-developers, they provided a program which shows how RIL works. Their example, last time I looked, shows how to start RIL, and listened for incomming SMS messages. To start with, find this code and add the rill calls to your program.
Click to expand...
Click to collapse
Can anyone tell me where this is please?
Also, does anyone have any code for returning gprs traffic usage? - I want to report the amount of data used in the current session and also in the current month.
Thanks!
--ian

Related

Get XDA to respond to AT commands.

Ive been looking around for a while to find ways to talk the GSM module with AT Commands. There seem to be a few ways:-
1) open a line using tapi the "cellular line", in datamodem passthru mode , getting a comm handle using lineGetID , write and reading commands.
2) open comm port 2 (which then blows up the phone normal comms) and writing and reading (found in the serial comms bit in this forum).
3) open comm port 9 (the virtual comm port) and reading and writing.
My problem is however that all these actually run code with out returning any errors, but i can not get a response from modem. Ive tried Dialing and just inquiring with
"AT\r\n", and would expect back "OK\r\n" like any normal modem. Has Anyone got this working or got any ideas? The forum hints that AT commands are possible but doesnt actually show you how..
Ill be grateful for a reply.
Thanks.
try to turn echo on to read reply.
( for newer roms, with wmodem.exe )
the trick is to send this ioctl after opening com2:
Code:
DeviceIoControl (hCom,0xAAAA5679L, {0x84,0}, 2,0,0,0,0)
( with {0x84,0} I mean a buffer containing these bytes )
you will be talking to the gsm together with the rest of the phone.
to silence the RIL layer, send this ioctl to the RIL1: device.
Code:
DeviceIoControl(hRil, 0x03000314L,0,0, &rildevresult, sizeof(DWORD), &nReturned,0)
looking at serial3.dll, 0xaaaa5677 and 0xaaaa5678 also seem to be
valid ioctls. - I have not experimented yet to figure out
what they do.
COM9: is used by rsupgrade, to update the radio rom.
( I sort of figured out how the protocol works, but have not been
able to actually send them through com9, I documented what I found on this page.)
I have been struggling with this for some time also. ok, so I opened COM2: and got my hCom to pass to
DeviceIoControl (hCom,0xAAAA5679L, {0x84,0}, 2,0,0,0,0)
and continue with the normal Read/Write functions (the same as writing to, say, COM1
... but still no response!
Do I also need 'to silence the RIL layer'? if so, where do I get hRil from for:
DeviceIoControl(hRil, 0x03000314L,0,0, &rildevresult, sizeof(DWORD), &nReturned,0)
Thanks
Andrew
Source Code anybody ??
Can somebody stop the ### and let the ppl know how to get that internal phone responding ??? Somebody out there must of made it work !!!! Some programs exist that do it but they dont wanna give their source code -!
Re: Source Code anybody ??
nutitija said:
Can somebody stop the ### and let the ppl know how to get that internal phone responding ??? Somebody out there must of made it work !!!! Some programs exist that do it but they dont wanna give their source code -!
Click to expand...
Click to collapse
Press the "Search" link, there are lots of samples posted on this forum.
dude thats sad
how f**ken dumb do u think i am , i'm asking for a working sample , i go through the search everyday if ur so smart why dont u post one for me ???
Please take a chill pill!!
Re: dude thats sad
nutitija said:
how f**ken dumb do u think i am
Click to expand...
Click to collapse
You are really dumb - http://forum.xda-developers.com/viewtopic.php?t=3347#26389
Tapi ??
sorry for being aggressive but yeh - i dont think i'm dumb anyways - just i'm not finding what i'm looking for !!! Can u guys check out my other posts as nobody seems to respond or have any idea what i'm asking. Thanks for the link was interesting not what i'm looking for though.
If anybody could assist me on this ?? just geting a working tapi sample to make a call on an XDA programmed in eVC++ would be really nice. And yes i have had a look around ... nobody seems to have done it or just gives away functions. I would like an entire source code.
cheers for ur help guys
Re: Tapi ??
nutitija said:
just geting a working tapi sample to make a call on an XDA
Click to expand...
Click to collapse
Look at your hard disk - "C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Samples\Win32\Cellcore\CeDialer\"
this is a dialer example. Uses TAPI.
nutitija. Try to use your brains (if you have them) and search for the info yourself. Everything is already explained in this forum or MSDN.
In my post I've provided a link to the entire source code of DLL that gets cell ID from the internal modem. Just copy&paste it into your project. If you cannot do such simple things - noone can help you.
Hi,
I try to communicate with gsm module throught the port COM9. I send at command but i have no answer.
I also try to open the port COM2 but i can't.
Somebody can help me ?
Thanks
Damien
What is COM9
Hi,
I was reading whole thread.. and found at many places that we can send data to virtual communication port, that is COM9, now what is that and how to open that and how to send - receive data from/to that.. please let me know...
thanks..
hi gregstarns, for you..
As you told,
1) open a line using tapi the "cellular line", in datamodem passthru mode , getting a comm handle using lineGetID , write and reading commands.
how you write and read from the comm port ?? can you please explain briefly... ??
In this topic and some others allready wrote. Can you read or only write?
1)You must say to RIL to drop COM-port (look DeviceIoControl)
2)Open COM2 for send commands
PS
http://forum.xda-developers.com/viewtopic.php?t=11701
look mamaich post
For COM9:
just open it after connection (use CreateFile)
and close before disconnection
i dont think u need COM 9 , im pretty much just using Com2 to send At commands .... i'm not too sure what the virtual port on COm9 does... maybe anyone wanna help ?? Maybe its to access data ?? during a datacall ??
OK wait a sec !!!! Are You saying that i should use
1) Tapi to establish a data call through COM2, by dropping RIL
2) Read data from COM9 the virtual port
I was pretty sure TAPI didnt need RIL to be dropped off as just by using the TapiMakeCall function i was able to establish a call. How would i establish a data call and read the info ??
Cheers for ur help
if i silent the RIL ....
can i still send SMS in PDU format as well as establish datacalls by an ATD command ?
couldn't able to open COM2
Hi,
It seems i got a basic problem. COM2 port of my i-mate is not opening. In these discussion i found, first I have to disconnect RIL using COM2. Infact many of here are discussing on the same. but no where i can see the code snippet which disconnet the RIL using COM2 so that i can access it for AT commands.
Hope you guys are already crossed this huddle by this time. It would be great help if you can post that piece of code.
Thanks for you all, most of the post I found to very useful and accurate.
Pramod.

RIL

Is any buddy working in the RIL now days. ????? :?:
Did any able to get the RIL_RESULT_ * notifications.
can some post some code , how to get this.
thanks, for u'r :idea: 's
What kind of details do you need?
To register for RIL_RESULT_* notifications you need to call RIL_Initialize() and pass in pointers to your result and notification handlers.
awm129 said:
What kind of details do you need?
To register for RIL_RESULT_* notifications you need to call RIL_Initialize() and pass in pointers to your result and notification handlers.
Click to expand...
Click to collapse
Thaks for the response,
Actually , i trying to check the call status (busy/not answered..)
i can not use TAPI ,and even i tried with AT commands(+CEER),but not worked
regarding RIL,
ihave sucessully done all the initlizations & i can get the Rx value,call start up ,disconnected notifications but i did not get any notifications for RIL_RESULT_BUSY etc.
if some body can post some code it will be more helpful
:?
wow its suprising , no body using the RIL :roll:
certainly we use RIL
but practically:
every device vendor (manufacture) implements own version of RIL, and every device vendor implements own modem. well, if not "every" than at least we know many versions actually on the market. it also can change when you update/change ROM version.
you can use RIL but you can check what commands are implemented in the specified device you interest, and then what AT commandes are implemented in modem
for example:
some devices response to AT command asks for CELLID, but some other devices (modems) do not
it's hard, but it exists in this status today
CellID and RxLev
maybe this can help u...
http://forum.xda-developers.com/viewtopic.php?t=3347&highlight=nicetrack
:wink: :?

How to switch Radio ON/OFF

Does anyone know how to write an application to switch radio on/off i PPC WM5?
Can you send me source ([email protected])? It could be in C++/C# or even worse
I was looking through google but nothing was helpful enough.
Thanks!
Danny, I'm still at work right now, no source code with me. I can try to send you some code a little later, subject to my brain functioning. If I don't send it tonight, please PM me tomorrow.
Basically, from memory, you have to set up a TAPI setup and toggle the radio mode there. Can't remember the details off hand though Later...
V
...originally it is meant to put audio continiously to your headphone by BT... but you can also use them offcourse as a shortcut to toggle on/off gprs, ir , bt.
Put the exe to anyplace and change shortcuts with total commander for changing the path within the files....
With thanks to VIJAY555...
Thanks Krinkiespijer!
... but what I'm waiting for is source code.
I have found tel.on-off_100.exe application which switches radio on/off but I have to write it in my own app!
Danny
Lost all day and still don't know how to do it....
Guys, I should clarify for Danny, that he's looking for a managed code solution. I've given him a pointer in native C++, but can't help with managed.
Danny, I suggest you look over http://www.opennetcf.org/ and then follow the functions I pointed you towards.
Basically you need to get a TAPI line and change the equipment state.
V
It's not that I need only managed code solution. I prefer it but native code is also enough. I was trying even understand it in native code but even msdn documentation is not enough to get by without complete source code.
Even though thanks for bothering
Hi guys, this is kinda OT here, but may i ask if there is a way to turn the Radio ON/OFF thru registry? Thanks
..no, you can only choose between always on or apps depending.
With next key key in register you can change it:
HKLM\CommConnMgr\Providers\{7c4b7a38-5ff7-4bc1-80f6-5da7870bb1aa}\connections\t-mobile]
always on dword=0=off dword=1=on
t-mobile is the name of your internetconnection

City name on Today

My old cellular phone Ericcson R600 is ale to display name of the City I'm actually in.
I would like to have the same on today screen in my MDA2.
Is it possible? Is there today plugin which can do that?
That is not possible. The 'City name' is a Cell Broadcast (CB) message sent on CB Chanell 50 - Windows Mobile can receive CB messages, but there is no special handling of specific CB messages.
is it hardware specific (radio ROM) or OS (WM5 ROM)?
It is not impossible, but such plugin is not known (till now).
It's possible to receive broadcasts (like SMS), don't disturb phone user and store information anywhere.
It is possible to retrive stored information and display on the today screen, too.
I was thinking about this plugin, but time... May be in january ...
actually, pocketmax's phonealarm plays around with "Location-based information (change profile dependent on current location!)" which I think is similar to what you are looking for: it picks up the CellID signal, but not sure what it translates into. The idea is that when you're at "work" it'll pick up on that cell tower and switch to that profile, but I don't think it gives you the "city name".
It's also an experimental addon that doesn't work on every service.
I don't need profile switching. What I need is ability to show on Today Broadcast messages from specific channels
This is possible but the app would have some problems on newer devices as the BCM messages are ignored if the header is similar (for power consumption reasons) so if you would stop the app and restart it but not switch cells you would get no CBM to retrieve info from...
But for XDA2/2i/3 it would work np.
so it's possible but no app? is it possible to write it such plugin in .Net? I don't know C++ well..
http://blogs.ssw.com.au/joehardy/archive/2004/05/26/214.aspx
Not sure if this will help you. The guy mentions home screen but I havent tried the app myself. Not sure what its compatible with.
bendog2784 said:
http://blogs.ssw.com.au/joehardy/archive/2004/05/26/214.aspx
Not sure if this will help you. The guy mentions home screen but I havent tried the app myself. Not sure what its compatible with.
Click to expand...
Click to collapse
It works on smartphones only.
there is a plugin called dktoday (its free!) that has this option...
does anyone know the cell broadcast chanell for t-mobile uk?
i have dktoday 1.80 and I don't see such option.
well this blog from msdn says it works...have you added the channel to be able to receive the info from your provider?
http://blogs.msdn.com/frankarr/archive/2006/04/05/568809.aspx
yes, i did it
dktoday seems to really slow down my 8125/wizard. anyone else see the same?
yeah, a little, and the battery meter is all over the place!
Worked on My Mini S
bendog2784 said:
http://blogs.ssw.com.au/joehardy/archive/2004/05/26/214.aspx
Not sure if this will help you. The guy mentions home screen but I havent tried the app myself. Not sure what its compatible with.
Click to expand...
Click to collapse
Thanks worked on my Mini S. With the same Code ie 50. Anyway of it being part of Today's screen?
did you read the rest of the thread??? :roll:
minty1978 said:
did you read the rest of the thread??? :roll:
Click to expand...
Click to collapse
Yeah I did read the thread. But dktoday is supposed to slow down the system. Was wondering if there is something else...
I'm using dktoday with Charmer. I have been using that since. I got the unit and it is not slowing down my phone. Charmer and Wizard is relatively the same hardware other than the WiFi and such.
Anywya, dktoday has the option of displaying lines that you need, e.g., it has 3 lines of information, you can have the choice of which line to be displayed. Try that, may speed things up for you.
UPDATE: Ok, I take my words back. dkToday DOES slow your unit down (e.g. the Today screen). Ever since I read this post, I'm trying to 'sense' the effect of dkToday. I had PocketBreeze installed and the 'slow' item on my Today screen is the PBreeze, which I presume it is because it is a heavy item. However, to my surprise, the dkToday seems to be the one causing the PBreeze (probably not just Pb, but all Today plugins). Since I had this program from the first day I had my unit, it doesn't occur to me that it is this that causes the unit to slow down (as many had complain about the slowness of OMAP processor).

Is there any software which can do this?

Basically I am looking for some software which, on receipt of an SMS will initiate an outbound call to a number in the contact list on the phone.
something along the lines of :-
SMS received from 1-555-5555 containing the word CALLBACK and a password.
Phone then dials 1-555-4444 or any specific contact as defined in its config
it doesn't have to use the contact list but must be triggerable remotely.
Target device is a HTC Hermes. and possibly a StarTrk
The program doesn't need to be stealthy, it's to initiate the call with full permission from the owner but without intervention.
Partly it's for my grandfather, if I give him a Startrk then I want to be able to activate a call remotely if I get notified that he has triggered his medicalert system, so I can try to see if he is ok without him having to answer a call.
I googled, and found nothing, I'm hoping someone here can either write an app that can do what I need, or suggest a product that will enable me to do this.
Auto answer is too generic, I want it to be just for myself and not all callers, and the password is because there may be times I just want to send a generic SMS
Sounds like you are talking about an SMS Callback trigger, though I have never heard of a mobile based one.
I always seem to want the impossible or the unwritten maybe it's time one was written?
Crash Override said:
I always seem to want the impossible or the unwritten maybe it's time one was written?
Click to expand...
Click to collapse
just unwritten, it's not impossible
pretty easy actually
i'll try to throw some together this week if/when I have the time
try this
Just place it on the phone and edit the config.ini if needed default settings are:
trigger = CALLBACK
password = pass
I tested this on my TyTn2, and it seems to do what you wanted, the program will activate the speaker when calling (can be changed in the config.ini)
this way if your grandfather cannot reach the phone he still be able to talk..
But test it before use, I'm not sure how sensitive the mic of the phone is.
I do like the idea so I'll probably add some more functionality
- auto pickup on call from fixed number
- status
- call/sms log
Let me know what you think.
PS. this was created for a touch screen device not a smart phone...
also I can not be held responsible for damages, phone bills etc.
but that goes without saying ..right
-=edit=-
tested by sending an SMS to myself, the program then called my number, but when i tried with a friends phone it didn't work
let me know if it works for you (if you have 2 phones)
also make sure if the number you send it from is in your phonebook or not (could be the issue)
-=edit=-
that is the issue, working on it
Issue solved
now I need to figure out how to replace the attachment
I'll add it in a new post
I also believe SKSchema can do this in watch mode. Actually SKSchema can do lots of cool things in watch mode.
new version attached
-=edit=-
build a cab, also added apptodate support
is it just me or does it seem to autodial the number that sent the SMS?
one addition would be the facility to set the option that if number X sent the SMS then callback to number Y
example - if I am in the US I will have the number 1-555-1234 but my grandfather is in the UK - +44-555-5555
I run a voip line with a UK DID number such as +44-555-6666 so when the SMS is received from 1-555-1234 the return call goes to the +44-555-6666 instead of the US Cellphone (cost reasons lol, UK landline free, international call of any length = US national debt)
Here is a SMS Trigger I built, do not know if that satisfy you.
Check rk-SMSSwitch under my signature.
Crash Override said:
is it just me or does it seem to autodial the number that sent the SMS?
one addition would be the facility to set the option that if number X sent the SMS then callback to number Y
Click to expand...
Click to collapse
yes you are right, don't know how i could have overlooked that
I'll fix this in the next version
any other requests?
:-D
-=edit=-
Program updated, you should be able to run apptodate to get the new version
don't you love just that program
Mr_Gee said:
any other requests?
:-D
-=edit=-
Program updated, you should be able to run apptodate to get the new version
don't you love just that program
Click to expand...
Click to collapse
Will there be a Smartphone version of this app that I could run on my QTek 8500 (StrTrk) ?
Thanks
timwb said:
Will there be a Smartphone version of this app that I could run on my QTek 8500 (StrTrk) ?
Thanks
Click to expand...
Click to collapse
Sorry, i just noticed this reply
To be honest i wasn't planning on creating one, but i could give it a shot
the biggest problem is i don't have a Smartphone to test it on..
I'm sure you could probably find a few testers in the forums, there's quite a lot of people on here!
I'll obviously be willing to test anything you are able to come up with. I don't know where you are located mr gee but on ebay UK you can buy an old Orange spv c500 (HTC Typhoon)or c600 (HTC Tornado I think) really cheap now. There are also WM6 roms available for these devices on this site somewhere.
timwb said:
I'm sure you could probably find a few testers in the forums, there's quite a lot of people on here!
I'll obviously be willing to test anything you are able to come up with. I don't know where you are located mr gee but on ebay UK you can buy an old Orange spv c500 (HTC Typhoon)or c600 (HTC Tornado I think) really cheap now. There are also WM6 roms available for these devices on this site somewhere.
Click to expand...
Click to collapse
I already checked eBay, and there might be some good ones but I don't want to overpay
I'll keep it in mind
Attached is the same program but compiled for a smartphone, I'm not sure if it will work, I remembered I have an emulator for smartphone installed, but I received an error message when running the exe.., I think because the CF.NET wasn't installed..
let me know
I tried it on my QTek 8500. The exe ran but all I got was a window with a blue background and the words "SMS2Call v. 0.03" in black.
No buttons to press or anything, had to use Task Manager to exit it. Which id did without complaint. Thanks for trying, some work may be needed I think
timwb said:
I tried it on my QTek 8500. The exe ran but all I got was a window with a blue background and the words "SMS2Call v. 0.03" in black.
No buttons to press or anything, had to use Task Manager to exit it. Which id did without complaint. Thanks for trying, some work may be needed I think
Click to expand...
Click to collapse
Currently that is the program
Could you try to edit the ini file?
in case you have 2 phones, add the number from the 2nd phone in the file
save and run the program
send an sms from the 2nd phone with the passcode mentioned in the ini file
your 1st phone should call this number after the SMS receipt
I know the program doesn't look like much but i might fix this in the future
when i do i'll also look at the exit button.
the reason i didn't was because the application was for an older person,
this person could be playing around with the phone accidentally closing the program ...
I looked in the .ini file and then tried sending a text to the phone containing the words CALLBACK PASS. I tried this with/without a space, up and lower case, with the program in the background or on screen but it didn't do anything. Do I have to put a shortcut in the Startup folder or something? Or am I not formatting the text message properly? The sending phone number is in the contacts list if that makes a difference.
Any ideas?
Thanks
Could you just not set his phone to auto answer ? - that way you can call him any time.
timwb said:
I looked in the .ini file and then tried sending a text to the phone containing the words CALLBACK PASS. I tried this with/without a space, up and lower case, with the program in the background or on screen but it didn't do anything. Do I have to put a shortcut in the Startup folder or something? Or am I not formatting the text message properly? The sending phone number is in the contacts list if that makes a difference.
Any ideas?
Thanks
Click to expand...
Click to collapse
not really, assuming it works maybe it has to do with the formatting,
Callback should be in capitals and pass in lower letters.
when I tested this with my TYTN2 it worked the way it should.
also did you enter the default number ? e.g. the number that will be called?
PauloJ5 said:
Could you just not set his phone to auto answer ? - that way you can call him any time.
Click to expand...
Click to collapse
[sarcasm]
Gee why didn't I think of that...
[/sarcasm]
Seriously have you read the thread?
the topic starter didn't want it this way for several reasons...
Default number and closed flip
I didn't enter a default number because I want it to respond to any number that sends the text. I deleted the DefaultNumber line from the config and it worked, to a point. The phone I'm running it on is a Qtek 8500/HTC StrTrk, which for those who don't know, is a flip phone. My problem is this, if the phone is closed when the text is received the call is made but cut off immediately because the phone is set to hang up calls on closing. Nowhere can I find a setting to stop this from happening, anybody have any ideas?

Categories

Resources