What are the parameters in the callback to lineInitialize(); - Windows Mobile Development and Hacking General

I'm using lineInitialize and lineopen to do things like query signal strength, but I was wondering what four of the parameters to the Callback are. I'm talking about the Callback made in LineInitialize.
The parameters I would like to get more info on are:
Msg, Param1, Param2, Param3
I believe Param2 is the Line Register Status, with values like LINEREGSTATUS_HOME but what are the others? The help on the function is extremely vague? Are the values device dependent? If so, does anyone know what the values are for the XDA/XDA2?

Ahh forget it...
The Param1, Param2, Param3 change depending on the MsgType, and the message type is defined in tapi.h

Related

Signal Strength

I am sure this question has been asked and answered many times. However a simple search of my subject line in 'programmers corner' yeilds no results.
How is it possible to obtain the signal strength at the current time?
Thanks, Ben.
In reply to my own message, a quick hack at the ril.h and I have a solution to getting the signal strength. My apologies to the authors of ril.h, and thanks to IP Dashboard for unknowingly providing the calibration.
If anybody want to use this, and until such time as the correct solution is published, this is a hack which works.
Beware, possible bug with rill.dll?? When connected to GPRS, the signal strength is always returned as 69% (183) ???
In ril.h add the following structure:
typedef struct {
DWORD dwUnknown1;
DWORD dwUnknown2;
unsigned char ucSignalQuality;
} RIL_SIGNAL_QUALITY;
And uncomment / adjust the definition of RIL_GetSignalQuality to:
HRESULT RIL_GetSignalQuality(HRIL lphRil);
Add a couple of global variables:
DWORD m_dwSigQuality = 0;
HRESULT m_dwSigQualityID = 0;
Edit the ResultCallback to include this code:
if (hrCmdID == m_dwSigQualityID) {
if (dwCode == 1) {
RIL_SIGNAL_QUALITY *data;
data = (RIL_SIGNAL_QUALITY *)lpData;
m_dwSigQuality = (data->ucSignalQuality == 255)
? 0
: (data->ucSignalQuality * 9 / 7) - 166;
} else {
m_dwSigQuality = 0;
}
m_dwSigQualityID = 0;
}
Add your own method to get the signal strength:
void OnButSigStrengh()
{
m_dwSigQuality = 0;
m_dwSigQualityID = RIL_GetSignalQuality(g_hRil);
int iTimeout = 100;
while (m_dwSigQualityID && iTimeout--) Sleep(10);
CString s;
s.Format(TEXT("Signal Strength = %u%%"), m_dwSigQuality);
MessageBox(s);
}
Which should work.
Ben
Ben -
Nice work -- the code snippet you posted is more or less what we did to get signal strength up and running in IP Dashboard -- of course, I had to do the calibration manually by walking around New York City while a test app spit out readings from the SignalStrength function and I looked at the signal bars, but hey, it was fun. I don't visit often or I would have responded sooner.
Here are the calibration readings we use:
#define ID_PHONEINFO_SIGNALSTRENGTH_POOR 0x80
#define ID_PHONEINFO_SIGNALSTRENGTH_FAIR 0xa1
#define ID_PHONEINFO_SIGNALSTRENGTH_GOOD 0xad
#define ID_PHONEINFO_SIGNALSTRENGTH_EXCELLENT 0xbb
#define ID_PHONEINFO_SIGNALSTRENGTH_NOSIGNAL 0xff
Regards,
Noah
Hudson Mobile
(makers of IP Dashboard)
Hey Noah, you know a very good addition to your program could be.
In the same way that you have that "floating" network icon, that you can position it on top or the bottom, (you even provide exact location on top, which I find it pretty useful). You should make another icon for the signal, just like the one from the phone, but the advantage is that yours can hold any skinning done in the phone. I have tried PocketBlinds, Facelift and others and your Network icon stays where it should, whereas the radio signal icon stays behind the skinning. and the option of making this icon show at the bottom, makes it even better, some people (like me) prefer seeing the icons at the bottom and not on top. This would make a great addition for your program and would make a killer app. Well, that and the addition also of a battery metter
By the way, if you need any kind of help designing the icons let me know, I would like to help
Yorch --
I saw your post at Wormhole Creations' website as well -- my apologies for not writing back, we are putting together our next product right now (tracker for phone voice minute usage) and things are hectic.
There is special code in IP Dashboard to make sure the taskbar icon floats above a skinned interface - we could potentially add a signal strength icon as well. Coincidentally, we really need ICON design help. If you are willing to design some cool icons for signal strength, I think we could probably work it into the product without too much difficulty over the next 1-2 releases. Let's take this to email -- I can be reached at nbreslow AT hudsonmobile.com
As for the Battery meter, we want to keep the product focused, but a simple battery meter function (line item that read: Battery X%) would be pretty easy to add as well.
Thanks for your interest and suggestions,
Noah
Hudson Mobile
Guys - Try Phone Dashboard, a Today Plug-in - Part of it polls real-time signal strength and displays it in percentage terms - v.Useful if you need a real validation of the Signal Strength bar.
Ben
How you getting on?
Drop me a mail...
Hello, the code above works like a charm!
I have however a side-effect: the radio icon on the top bar seems to indicate that the radio is off (I cannot receive calls) when I run the program. A couple of minutes after I close it, it goes back to normal.
This is my initialization line:
res = (*fpTAPIrilInit)(1, AsyncCallBack, NotifyCallBack, RIL_NCLASS_MISC, 0x55AA55AA, &hRil);
Any thoughts?
Many thanks for the help!
why cant ppl just post source codes it would be sooo much helpfull !!!
It need to get signal strength on my Universal, too. So
does it work with on HTC Universal with new WM 6 ?
thanks,

Changing speaking loudness on the telephone (with TAPI)

I've a question to change the telephone sound volume of the mda II for speaking. For this I found the function phoneSetVolume(HPHONE hPhone, DWORD dwHookSwitchDev, DWORD dwVolume) of the TAPI.
Now I've the problem that I don't know how to get the handle to the phone (HPHONE).
Can anybody help me?
Thanks!
use phoneOpen
There is still a problem...
Okay, but the function phoneOpen requires also parameters which I don't know where I can get they. For instance the HPHONEAPP. Where can I get the phone application or the deviceID and then the LPPHONE.
I am very thankful to you when you could help me how to get the parameters.
Or is it possible to change the volume of the telephone speaker by changing a registry key? Do you know the key name?
Thanks a lot!
Re: There is still a problem...
phoneInitializeEx gives you PhoneApp and number of phone devices, phoneOpen gives you hPhone, deviceID is probably 0 (test all deviceIDs starting from 0 to the count returned by phoneInitializeEx). Read MSDN for more information.
I don't know the registry key, and modifying it would not change the device volume immediately.
Thanks for your reply!
When I use the function phoneInitializeEx() it returns a value that is negative but not an determined error. Here is my code. Can you say me whats wrong?!
HPHONEAPP lpHPhoneApp;
DWORD lpdwNumDevs;
DWORD lpdwAPIVersion;
PHONEINITIALIZEEXPARAMS lpPhoneInitializeExParams;
long result = phoneInitializeEx(&lpHPhoneApp, NULL, NULL, NULL, &lpdwNumDevs, &lpdwAPIVersion, &lpPhoneInitializeExParams);

sort the AutoCompleteTextView list

Hi!
I have an alphabetically sorted list of strings for the AutoCompleteTextView,
some strings have 2 words,
when I type a letter, I would that the autocomplete list that appear shows the strings sorted by the letter typed
for example:
I have this list alphabetically sorted: New Orleans, Omaha, Portland, Rome
now, if I type 'O', the first string in the autocomplete list, is New Orleans, the second Omaha,
but I would that Omaha is the first string because it start with 'O' and after New Orleans that doesn't
You should probably use a custom adapter and filter which sorts the results before returning them. Implement Filterable in your custom adapter, subclass http://developer.android.com/reference/android/widget/Filter.html, which does the filtering and calls Comparator.sort before returning any results. When getFilter() is called on your adapter, return an instance of your Filter subclass.
thank you for the answer,
I have solved the problem modifying the code of ArrayAdapter
can you please post a sample source for the filter part?
i have a custom adapter in the list and i need to implement filter on it.
Can you please let me know how this is achieved? I am having the same issue and could not be able to find the solution

Simple ArrayList issue

Hey all, I create an array list, and I populate the array list with 3 items.
When I call .remove(index) on the array list it doesn't error, but then I call .size() on the next line and it's the same size!
Sooooo what exactly got removed? Is there something I'm missing with ArrayLists?
Please help
Try stepping through the code with a debugger. Compare the state of the list before and after the call.
+1 on using the debugger.
Are you checking for IndexOutOfBoundsException with try/catch?

How to call ATT service numbers (numbers ending with #) in the app

Hi all,
I need a feature in my app to call AT&T and check the balance or minute usage. For example, to check how many minutes I have used, normally I should dial *MIN# (*646#) on my phone, and then I will get a text message.
I use the following simple way to make the phone call:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:*646#"));
However in my app it seems the ending "#" is always ignored and the number my app dials is always *646, which goes nowhere.
Can anyone let me know how I can get to call the number with its ending character "#"?
Thanks,
Lik
Maybe try a backslash before the pound sign.
Code:
callIntent.setData(Uri.parse("tel:*646\#"));
I did try that but it didn't work.
What about the "*"? I'm guessing that Uri.parse() is trying to "parse" the string and that some character or another is being interpreted as a control character by the "parse" function.
Edit:
OK, I just did a search on URI encoding and found this:
http://www.tutorialspoint.com/html/html_url_encoding.htm
and according to this:
http://developer.android.com/reference/android/net/Uri.html
a "#" sign is interpreted as a fragment delimiter.
The first ref says to use "%23" to encode the # char so try this:
Code:
callIntent.setData(Uri.parse("tel:*646%23"));
That works. Thanks.

Categories

Resources