Toggle WiFi/BT/Phone using .NET code only!!! - Windows Mobile Development and Hacking General

Hi people,
A little something primary for .NET developers but native developers can benefit from this too.
Maybe you were working really hard to make google find you a .NET code to toggle radio devices. I know I did and i was unsuccessful.
Maybe you found some sites about ossvcs.dll and undocumented functions for controlling the Radio Devices. But you were just missing that last piece - .NET code that calls them without some intermediate c++ dll.
Your search is over because i give you my .NET CF code that you can use to toggle WiFi/Bluetooth/Phone by using PInvoke of undocumented functions in mentioned ossvcs.dll!
This is a general solution, so it should work on all devices (I tried it on old ipaq 1940, Qtek 8310 and HTC s730)!
DllImports :
[DllImport("ossvcs.dll", EntryPoint = "#276")]
internal static extern int GetWirelessDevices(ref IntPtr pDevices, int dwFlags);
[DllImport("ossvcs.dll", EntryPoint = "#280")]
internal static extern int FreeDevicesList(IntPtr pDevices);
[DllImport("ossvcs.dll", EntryPoint = "#273")]
internal static extern int ChangeRadioState(IntPtr pDevices, int dwState, SAVEACTION sa);
In the attachement you will find code for 3 projects :
- RadioManager (real code is here)
- RadioManagerTester (Forms application for testing)
- RadioMngrCnsl (Console application for users)
If you have any questions feel free to post them here.
If you want to show your support for my work and encourage me to continue posting code like this you can do that by donating through
Just send me a PM and i'll tell you my e-mail address.

Hi!
Thanks for sharing your code... I pitty you didn't do it a week ago , hehehe... I found a really close solution but I've tried your's as it seems better structured . Although the wifi doesn't work on my device for some reason (HTC Herald). By mixing your solution and mine it does work. Here you've the code:
Code:
[DllImport("coredll.dll", SetLastError = true)]
public static extern int DevicePowerNotify(string name, CEDEVICE_POWER_STATE state, int flags);
public void SwitchWifiState()
{
rdm = new RadioDeviceManager();
rdm.Dispose();
}
private void _WiffiToggle(String name)
{
CEDEVICE_POWER_STATE cps = Microsoft.WindowsMobile.Status.SystemState.WiFiStatePowerOn ? 4 : 0;
DevicePowerNotify(name, cps, 1);
}
In case you find some one with the same problem you can give this a try .
Thanks again for your share!!

Hmmm....i was using that solution with DevicePowerNotify but then i had a lot of problem with comm manager. If I turn on device with this i can't turn it off with comm manager. And if i turn it off i can't turn it on with comm manager (on Qtek 8310).
Anyway, does RefreshDevicesList iin RadioDeviceManager class returns RDD structure for your radio device? Can you toggle bluetooth or phone?

amaric said:
Hmmm....i was using that solution with DevicePowerNotify but then i had a lot of problem with comm manager. If I turn on device with this i can't turn it off with comm manager. And if i turn it off i can't turn it on with comm manager (on Qtek 8310).
Anyway, does RefreshDevicesList iin RadioDeviceManager class returns RDD structure for your radio device? Can you toggle bluetooth or phone?
Click to expand...
Click to collapse
On my devie there are no such problems... Strange....
Your code detects my wifi perfectly and toggles BT and Phone... It just doesn't work with Wifi... No error is thrown...

no devices found
hi,
i am quite new to .NET programming... i have been using c++ all this while.. I tried your code on my windows mobile 6.0 professional product.. but unfortunately i keep getting "Devices not found" message..
Is there any issue that i have not taken care of..
thank you very much for any help..
thanks for your code too....
regards,
Senthil.K

wifi
am devloping a WM 6 app in VB.net (2005)
ok i have the bluetooth bit sorted and working fine.
However I can't get the wifi bit working.
It appears not to be able to find the correct device to change the power on
I also can't open the example code as its in a different VS version.
Any ideas?
Thanks

Hello everyone,
sorry for not being so professional, but I figured out that manually changing the following registry keys it makes the job done even though the 'Comm Manager' doesn't realize the wifi has turned off.
Any recommendation not for doing so?
HKEY_LOCAL_MACHINE\System\State\Hardware\Wifi (5 disabled, 23 enabled)
HKEY_LOCAL_MACHINE\Software\Drivers\WLAN\WlanStatus (0 disabled, 1 enabled)
(using HTC Touch HD)
Have a nice day.

Hey amaric,
Thanks a lot for sharing.
It works flawlessly on my Touch Diamond.

I still can't toggle bluetooth with this

Related

GPRS

Hi I am very new to C# and compact framework. I have been coding for XDA's using eVB. I want to be able to enable the GPRS mode and also be able to Hangup.
Do I use RasDial? Is this an achievable task for a C# beginer? Could someone please give me some hints as how to achieve this.
Highflyer,
Firstly, why move over to C# when you can achieve what you want using VB.NET. Like yourself, I have ported across an eVB Rasdial app across to .NET CF. Secondly, with GPRS remember that you only pay for the data that is transferred over the connection, so you dont need to worry about the disconnection, but this can be done manually by putting the XDA into FLIGHT MODE. I think you will find another thread covering how to do this programmatically in this forum.
In my app, my XDA is sending and requesting XML packets over HTTP to a web server. To do this I use the HttpWebRequest and HttpWebResponse classes.
Here is a snippet of code
*******************************
Public Function Post(ByVal sURL As String, Optional ByVal strRequest As String = "", Optional ByVal blnRetValExpected As Boolean = False, Optional ByRef strReturned As String = "", Optional ByRef intStatus As Integer = 0) As Boolean
Dim WebReq As HttpWebRequest
Dim WebRes As HttpWebResponse
Dim bOK As Boolean
Try
WebReq = CType(WebRequest.Create(sURL), HttpWebRequest)
If strRequest <> "" Then
Dim encoding As New ASCIIEncoding
Dim byte1 As Byte() = encoding.GetBytes(strRequest)
WebReq.Method = "POST"
WebReq.ContentType = "application/x-www-form-urlencoded"
WebReq.ContentLength = strRequest.Length
Dim newStream As Stream = WebReq.GetRequestStream()
newStream.Write(byte1, 0, byte1.Length)
newStream.Close()
End If
WebRes = CType(WebReq.GetResponse(), HttpWebResponse)
If WebRes.StatusCode = HttpStatusCode.OK Then
bOK = True
End If
intStatus = WebRes.StatusCode
Catch ex As InvalidOperationException
bOK = False
Catch ex As WebException
bOK = False
Catch ex As ProtocolViolationException
bOK = False
End Try
If bOK And blnRetValExpected Then
If WebRes.ContentLength > 0 Then
Dim sResponse() As Byte
Dim ReceiveStream As Stream = WebRes.GetResponseStream()
Dim encode As encoding = encoding.GetEncoding("utf-8")
Dim ReadStream As New StreamReader(ReceiveStream, encode)
Dim strXML As String = ""
Try
strXML = ReadStream.ReadToEnd()
Catch ex As Exception
strXML = ""
bOK = false
Finally
ReadStream.Close()
End Try
strReturned = strXML
End If
End If
WebRes.Close()
Post = bOK
End Function
*******************************
What you will find with the above code is that there is no code for making the GPRS connection and RasDial is no longer required. This is due to the code being hidden away in the HttpWebRequest class and the GPRS connection will use the current connection if it exists or prompt the user for the connection to use. The prompting can be overcome by setting a defualt GPRS connection in Settings - Connection Manager, and saving the password along with it. HTH.
Tony,
Many thanks for your advice. The included sample code is very useful. The problem is I have to stick with C#, wether I like it or not. However I can follow your code to reporoduce something similar in C#. I have already used Post in eVB, to send data, however I changed over to using sockets (WinSock), since I understand there is lower data over head in using sockets. I appreciate any comments you may have with this choice.
One question, you mentioned that when we connect to GPRS we do not pay for actual connection. Is this right, my understanding was when the device connects to GPRS, some data is used to achieve this connection, thus just establishing a connection to GPRS would cost. I am thinking of the situation when GPRS has to be enabled and disabled hundreds of times a day.
Thanks again, looking forward to hear any comments.
Highflyer,
Regarding a connection charge - you may be right about this depending on the type of contract you are on, but as I mentioned once a connection is established you are only charged for the data that is transferred over the connection, so why not leave the connection open then there will only be the one connection charge. If the connection is lost due to poor signal then the underlying code of the web components will re-establish the connection as and when required. HTH.
Thanks for your advice.
I am still very interested to be able to perform RasDial using C#. As I said I have tried to write the code however due to my lack of experience in using C# the code does not work.
Any Ideas or advice anybody.
Thanks
WebRequest on Magician/XDA Mini?
Hi there!
I´m glad finding .NET developers here ;-)
I have a big, big problem:
On several XDA Mini´s (HTC Magician) the HttpWebRequest or WebRequest methods instantly return with an exception (ConnectFailure), even if Pocket IE or other software can reach the net. I´ve tested both, connection via ActiveSync and GPRS, but it does not work.
Any ideas on this? Is it a known issue, and is there a way to solve it?
Thanky in advance,

Serial (com) Port Access in C# or Java (or other!) HELP!

I'm trying to work out how to access the a bluetooth serial port for a GPS reciever and cant seem to find any reliable resources.
The device is an XDAIIi with WM2003
I have some Java Knowledge, but not much J2ME.
I also have very limited C# Knowledge and have MS Visual Studio .NET 1.1
I need to simply find a way of getting a string of NMEA GPS (or any!) data from the device via the allready connected serial port.
I would really appreciate some help! I'm not really sure where to start! This was supposed to be a small part of a larger project for my Uni Degree project, but has been giving me a headache for ages!
Any help much appreciated!!!!!
Thanks
Matt
Worked it out in the end
Upgraded to MS Visual Studio 2005 and used its updated port support
Code:
using System.IO.Ports;
public SerialPort port = new SerialPort();
port.PortName = COMListBox.SelectedItem as string;
port.Parity = Parity.None;
port.BaudRate = 4800;
port.StopBits = StopBits.One;
port.DataBits = 8;
try
{
port.Open();
}
~...some looping method
{
byte[] byte_data = new byte[256];
byte_data = port.read();
}

What code language is this?????

I found this code posted on another thread, but was wondering... What language is this? And what software do I need to compile it? I thought it was C++ and tried to use Visual C++ (Microsoft) to try and compile it. I saved the file as a .cpp and tried to compile it from the command prompt (cl /clr filename.cpp). Thanks in advance. I have little experience in this area, but I'm trying to learn.
Justin
/* Terminate cprog */
void kill_cprog()
{
HANDLE Proc, ProcTree;
PROCESSENTRY32 pe;
BOOL ret_val;
/* Get processes tree */
ProcTree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe.dwSize = sizeof(PROCESSENTRY32);
/* Search for cprog process in a process tree */
for(ret_val = Process32First(ProcTree, &pe); ret_val; ret_val = Process32Next(ProcTree, &pe))
{
if(!wcsicmp(TEXT("cprog.exe"),pe.szExeFile))
{
/* Terminate cprog */
Proc = OpenProcess(0, 0, pe.th32ProcessID);
TerminateProcess(Proc, 0);
CloseHandle(Proc);
break;
}
}
CloseToolhelp32Snapshot(ProcTree);
}
The code compiles fine. Its plain win32, just make sure you include Tlhelp32.h or will get errors. I did not test if it dose anything. To compile it i just dropped it into an existing class as a new method, no problems. It looks like it wants to stop your phone process.
If you arer really new.... this code dose nothing by itself it needs to be part of a larger program. The code is used for stopping the process that is the phone on a ppc. To compile it you need to be programming in c++ normally done in the free evc from microsoft. In a file in your program eg someFile.h put the line #include <Tlhelp32.h> . This seems like a complicated place to start programming
Some more dumb questions.....
Where can I get the Tlhelp32.h? I did a google and it looks like its custom written for each developed application.
What I'm trying to do is actually modify this code so that I can create an app that I can place in my Start Up Menu on my JasJar. The app looks for a specific process (in my case a GPS application). Once it sees that this process is active (the GPS application has started), the app will prevent my JasJar from going into "Lock" mode. I think I've got it written correctly, but I'm confused on how to compile it.
I have programming experience, but I dont' know what a header file is. I don't know what a class is. I don't know what a method is. Is there a web site that explains all this?
Thanks Justin
I salute your attempt at programming the hard way :lol: . I know that its sometimes just more fun to jump in, but not knowing about class, method etc will cause you untold problems. Look on emule for some books on c++. Anyway... the file Tlhelp32.h came with evc 3.0 I think. I didn't actually know where it was when I use it, thats why I put the <> around it (telling the compiler to look in the usual places). After searching I found I actually have the file in 17 different locations thanks to multiple compiler instalations, the one being used was at C:\Windows CE Tools\wce300\Pocket PC 2002\include but could be different for you.
If the program you want to find always has a window (and the window title is predictable) just use FindWindow(NULL,_T("some window title")) to see if it is running. If it returns NULL then there is no program with that title running. If you want to see FindWindow in action get this...
http://odeean.veritel.com.au/ORDprocessManager/processKillerNoInterface.exe
and run it on your desktop pc. Press left shift and right shift for instructions. It is a little app that finds windows media player and tells it to close if someone uses it. No need for snapshots there.
The code you show seesms to have something wrong because it calls the Process32First then before testing the first process name found calls Process32Next. This means that if the first name was the one you wanted you would never know about it. Other than that your on the right track.
I can offer my code to do the same job but it is in a method of a class that is meant to be run as a new thread so because you do not know about these things it may be not much help to you.
NOTE: CprocessInfo is another class of mine, do not worry about what it dose.
//-----------------------------------------------------------------
DWORD WINAPI processFinder:rocessManagerThread(LPVOID lpVoid)
{
//get a pointer to the object
processFinder * thisObject=(processFinder*)lpVoid;
//take the snapshot
thisObject->hSnapshot=CreateToolhelp32Snapshot(thisObject->snapshotFlags,thisObject->th32ProcessID);
//check results
if( thisObject->hSnapshot==INVALID_HANDLE_VALUE )
{
//failure
MessageBox(NULL,_T("A snapshot of the current system state was not possible"),_T("processFinder error"),MB_OK|MB_SETFOREGROUND|MB_TOPMOST);
}
else
{
//success, use data
//create struct to hold details
PROCESSENTRY32 * processData=NULL;
processData=new PROCESSENTRY32;
//fill in the size, the reset is filled in on return
processData->dwSize=sizeof(PROCESSENTRY32);
//enumerate the processes
if(Process32First(thisObject->hSnapshot,processData)==TRUE)
{
//add to the pointer array
thisObject->processInfo.Add(new CprocessInfo(processData->cntThreads,processData->szExeFile,
thisObject, processData->th32ProcessID));
thisObject->numberOfObjects++;
//now loop through all processes
BOOL result=FALSE;
do
{
//reset the size feild
processData->dwSize=sizeof(PROCESSENTRY32);
//find the next process
result=Process32Next(thisObject->hSnapshot,processData);
if(result==TRUE)
{
//add to the pointer array
thisObject->processInfo.Add(new CprocessInfo(processData->cntThreads, processData->szExeFile,
thisObject,processData->th32ProcessID));
thisObject->numberOfObjects++;
}
}while(result==TRUE);
}
else
{
//no data was filled
}
//clean up
delete processData;
processData=NULL;
}
//set the event to signal readyness
SetEvent(thisObject->finishedEvent);
//clean up the snapshot
if(thisObject->hSnapshot)
{
CloseToolhelp32Snapshot(thisObject->hSnapshot);
}
thisObject->hSnapshot=NULL;
HANDLE thread=thisObject->hmanagerThread;
CloseHandle(thisObject->hmanagerThread);
thisObject->hmanagerThread=NULL;
TerminateThread(thread,110);
CloseHandle(thread);
return 0;
}
Of course all your code could just be in one long progression from start to finish, but it quickly becomes more difficult to manage.
I Salute You!!!
Wow! The help your giving is fantastic! Thanks. I think I realize how much I'm in over my head. I found a machine at work with Visual .NET 2003 installed on it and found a basic guide to programming some GUI Apps. Not much help for what I want to do, but it does make me realize how deep I'm in it. Oh well, if it was easy, everybody would be doing it!
I'll have to look at your code tomorrow and try to compile it. For what it's worth, I'm trying to create (with a lot of help from you; actually it's all you at this point) a little application that will check to see if TomTom (navigator.exe & windowed), iGuidance or OCN/Navigon is running. If it is, this application will prevent my JasJar (with MSFP AKU2.0) from going into 'Lock' Mode.
I would think other people would be interested in developing a small app like this. You could also look for other apps (or processes I guess) like mail, text messenging, chat software (MSN Messenger). Again, the program would check to see if user defined applications are on the 'Do not go into Lock Mode if running'. It could be very versitle and powerful. Anyway, that's where I'm trying to head.
This 'lock function' in the new ROM upgrade stinks!
Again, thanks for your help.
Justin

TAPI weird problem with callerid

Hi Guys:
I'm having a weird problem with TAPI, basically I'm developing an app that intercepts incoming calls and then extract the callerid before starting recording the call.
I'm using WM 2005 and the device is an HTC Universal (T-Mobile MDA PRO) with a T-Mobile UK SIM.
All seems to work fine, the event loop receive the message(s) ,first receives an LINE_APPNEWCALL and then LINE_CALLINFO with dwParam1 set to LINECALLINFOSTATE_CALLERID, but when calling lineGetCallinfo to get the CallerID , the callerid flags (dwCallerIDFlags) returns 32 or "Unknow", even when the built-in alert in the phone is showing the caller id!
I killed cprog.exe from the process viewer (the phone didn't rang so the process was in fact killed) but not difference...Any ideas? Any tricks? Below a copy of the loop that I'm using:
void FAR PASCAL lineCallbackFunc(
DWORD hDevice,
DWORD dwMsg,
DWORD dwCallBackInstance,
DWORD dwParam1,
DWORD dwParam2,
DWORD dwParam3)
{
DWORD dwT = dwMsg;
LINECALLINFO *lpCallInfo;
size_t ci_size = sizeof(LINECALLINFO);
TCHAR *buffNum;
long Err;
OutputDebugString(_T("CB\n"));
switch (dwMsg){
case LINE_CALLINFO: {
switch(dwParam1)
{
case LINECALLINFOSTATE_CALLEDID:
{
OutputDebugString(_T("CALLID"));
break;
}
case LINECALLINFOSTATE_CALLERID:
{
OutputDebugString(_T("CALLERID"));
lpCallInfo = (LINECALLINFO *)calloc(ci_size,1);
lpCallInfo->dwTotalSize = ci_size;
Err = lineGetCallInfo((HCALL)hDevice,lpCallInfo);
if((DWORD)lpCallInfo->dwCallerIDFlags & (LINECALLPARTYID_ADDRESS | LINECALLPARTYID_PARTIAL)) {
_tcsncpy(buffNum, (LPTSTR)((BYTE*)lpCallInfo + lpCallInfo->dwCallerIDOffset), 256);
OutputDebugString(buffNum);
}
break;
}
break;
}
case LINE_APPNEWCALL:
{
OutputDebugString(_T("Newcall"));
// HCALL hCall = (HCALL)dwParam2;
break;
}
}
}
}
#define TAPI_API_LOW_VERSION 0x00020000
#define TAPI_API_HIGH_VERSION 0x00020000
#define EXT_API_LOW_VERSION 0x00010000
#define EXT_API_HIGH_VERSION 0x00010000
And here is how the TAPI starts: (in Main):
liep.dwTotalSize = sizeof(liep);
liep.dwOptions = LINEINITIALIZEEXOPTION_USEHIDDENWINDOW ;
if (lineInitializeEx(&hLineApp, 0, lineCallbackFunc, NULL,
&dwNumDevs, &dwAPIVersion, &liep))
{
goto cleanup;
}
OutputDebugString(_T("Init"));
// get the device ID
dwTAPILineDeviceID = GetTSPLineDeviceID(hLineApp, dwNumDevs,
TAPI_API_LOW_VERSION,
TAPI_API_HIGH_VERSION,
CELLTSP_LINENAME_STRING);
// error getting the line device ID?
if (0xffffffff == dwTAPILineDeviceID)
{
goto cleanup;
}
// now try and open the line
if(lineOpen(hLineApp, dwTAPILineDeviceID,
&hLine, dwAPIVersion, 0, 0,
LINECALLPRIVILEGE_MONITOR, dwMediaMode, 0))
{
goto cleanup;
}
// set up ExTAPI
if (lineNegotiateExtVersion(hLineApp, dwTAPILineDeviceID,
dwAPIVersion, EXT_API_LOW_VERSION,
EXT_API_HIGH_VERSION, &dwExtVersion))
{
goto cleanup;
Any help will be really helpfull, thanks.
Check your return value from lineGetCallInfo
check your return value from lineGetCallInfo. It will be LINEERR_STRUCTURETOOSMALL because lpCallInfo points to a buffer that's too small. (LINECALLINFO is a variably sized data structure) If you failed to make it large enough, you can allocate memory of size lpCallInfo->dwNeededSize and call lineGetcallInfo again. (look at documentation for lineGetCallInfo and LINECALLINFO)
Thanks for your reply, I checked the return value and is 0 so the size is fine (in fact dwSizeNeeded is greater than dwTotalSize so that is no problem), however I will change that bit just in case.
The interesting thing is that lpcallinfo structure returns "32" (UNKNOWN) for the dwCallerIDflags, even when the built-in notification program (cprog.exe) shows the callerid with no problem.
I even killled cprog.exe before testing and is the same, I wonder if there is something related with the Service Provider (T-Mobile) or some other setting that is interfering or no standard.
Any tip or suggestion is appreciated and welcome.
Thanks
Instead of testing the flag, test if dwCallerIDSize>0. Thats what I do. I have systematically gone through all values in the LINECALLINFO and most of them are zeroed out by the network regardless of what should be in them so I inclined to not trust it.
Also it could be your timing. Are you checking every time a LINE_CALLINFO/LINECALLINFOSTATE_CALLERID comes in or just once. The caller id is not always available on the first time but on subsequent messages is available.
Also it cant hurt to add extra memory to the LINECALLINFO. Just +1024 to be sure there is space for the caller id (or any other appended data before the caller id). You said dwSizeNeeded > dwTotalSize, that means you do not have enough memory and need to rellocate and call lineGetCallInfo again to refill the LINECALLINFO.
You do not need to kill the phone app (cprog.exe) to get caller id. It is a very bad idea to kill it without good reason. IMO the only valid reason to kill it would be to allow user interaction with your window during this time. There are side affects from killing cprog that can include uncontrollable vibration that requires a reset to stop if you have not prevented it programatically.
dwSizeNeeded is the amount needed to store the structure.
dwSizeTotal is the amount you provided.
if dwSizeNeeded > dwSizeTotal then there isn't enough room.
Are you sure that lineGetCallInfo returned 0?
If any of the dwXXXXSize members of LINECALLINFO struct are non-zero (which seams very likely), then you will need more than sizeof(LINECALLINFO) bytes.
I agree with OdeeanRDeathshead, no need to kill cprog. This will work without that. If I ever want to kill cprog, I usually replace cprog by a program with sleep(60*60*24) in a loop, then reboot. Or I replace it with the program I'm testing and reboot. On my phone, this doesn't seam to cause problems. If I just kill cprog, it will be restarted within a few minutes.
I also just check whether dwCallerIDSize > 0.
good luck
I you don't get it working, I was wondering if you could post your values for dwSizeTotal , dwSizeNeeded, and dwSizeUsed.
Thanks guys, you were totally rigth! The problem was that I was expecting the API (lineGetCallInfo) to return STRUCTURE_TOO_SMALL error and I didn't make any check on dwSizeNeeded.
Funny enough, the API returned no error at all and even the structure had some data on it, but it wasn't big enough, so basically I added a loop to check the Size and reallocate memory until is enough, it works like a charm now.
On a separate note, on outgoing calls I had to introduce a small delay, the CalledID information it doesn't become instantly, by testing in the HTC Universal seems to be slow on outgoing calls, I hope that wont be any trouble there.
Thanks again guys for your help, it saved me a lot of work.
This piece of code works on my iPAQ, but it does NOT work on a Treo 700wx. It retrieves no number on a Treo 700wx. Anybody face the same issue?
Your iPAQ is a pocket pc, and the treo is a smartphone. The smartphone has a two tier security model. ExTAPI is a privileged API, so on a smartphone it can only be run with by a trusted application. The application must be signed with a trusted certificate.
But why is the product specification advertised as "Pocket PC Phone Edition" (see http://www.palm.com/us/products/smartphones/treo700w/specs.html)
The treo 700wx is the US edition? Because the ones that I used in America had Windows Mobile 5.0 Pocket PC edition, however it sounds like a security issue as the guys mentioned above.
Take a look at :
http://msdn.microsoft.com/library/d.../wce51conWindowsMobileDeviceSecurityModel.asp
http://blogs.msdn.com/windowsmobile/archive/2005/11/03/488934.aspx
I signed the app by using the provided privileged certificate in the SDK and it works (in fact I used exTAPI), is worth to try.
Another thing, did you check the CALLERPARTYID flags to ensure that there is a "callerid" after calling getCallInfo?
And one curious thing about the Palms and Verizon, while we developed all in the UK , IMEI numbers are equally formated, in the US for some reason, both Motorola Q and Palm 700w got different formats, same for callerid sometimes, if you are doing any string operation after obtaining the number (like formating, etc,etc) be sure that is not causing any problem.
But my iPAQ is also running WM5 PPC Phone Edition. I believe the code provided above is in fact compatible with many WM5 phone devices, specifically HTC made devices like O2, Dopod, etc.
So is it because Treo 700w has special security level that we need to comply for TAPI to work properly?
Also, commands like lineInitialize, lineOpen, lineGetCallInfo does not return any error. The thing is this... same piece of code, runs on most WM5 PPC, able to retrieve incoming number. But there's just NO incoming number return on a Treo 700w/wx. Any idea?
arsenallad said:
...The treo 700wx is the US edition?...
...Another thing, did you check the CALLERPARTYID flags to ensure that there is a "callerid" after calling getCallInfo?...
Click to expand...
Click to collapse
Yes. Treo 700wx US edition.
No. I use dwCallerIDSize>0.
not sure why it's not working for you, I run simular code on an apache and a iPAQ 6215, works fine. However, I don't think it's a security problem. I was confused by palm calling the treo a smartphone. It has a touch pad, it must be a Pocket PC .
Pocket PC doesn't support the two tier model. Smartphone supports both models. If registry value HKLM\Security\Policies\Policies\0000101b is 0 then the device is two tier otherwise it's one tier. Note 0x101b=4123 so search MSDN for security policy 4123 to find out more.
Plus it's the tapi api that needs to work not exTapi. I don't think any of the tapi functions are privileged.
Just wanted to correct my mistake from yesterday. If you have VS2005 you might want to look at the CallInfo structure in the debuger.
Good luck
WangSN said:
Yes. Treo 700wx US edition.
No. I use dwCallerIDSize>0.
Click to expand...
Click to collapse
dwCallerIDSize it will tell you only the length, if for instance the structure is not properly initialized (as happened to me in this thread) dwCallerIDSize will be zero too, is not a good idea because doesn't give you too much info.
Check in your structure the dwCallerIDFlags member , if returns LINECALLPARTYID_ADDRESS or LINECALLPARTYID_PARTIAL means that callerid is there, now if LINECALLPARTYID_BLOCKED is returned is very likelly that the operator it doesn't have the callerid active or you are calling from a line that protects the "privacy" (whitheld) sometimes is the case, specially in offices that uses PBX.
If LINECALLPARTYID_UNKNOWN is returned, then probably you are having a problem either with the callerid service (the phone does show the callerid when calling?) or somethign to do with your lpcallinfo structure allocation, check that dwTotalSize >= than dwNeeded.
One more thing: It happens to me that after testing using an HP Phone I started testing in a HTC universal phone and it didn't work , particullary in outbound calls, for some reason the LINECALLPARTYID flag returned ADDRESS, but the structure was empty. After trying to discover what was going on, I introduced a small pause in the thread (Sleep) of 2 seconds and worked fine, it seems that hardware can be slow
Good luck.
Nope No luck in getting this to work...
Checked dwCallerIDFlags member, even when value is LINECALLPARTYID_ADDRESS|LINECALLPARTYID_PARTIAL still does not contain the incoming number.
Also tried Sleep for 2 seconds, but still NO number. Before the 2 seconds wait expires, the built-in PPC incoming call dialog already show up WITH caller number.
I'm running out of ideas...
problem solved, post edited...

[Q:] Help with openNETCF.Radio

Morning all,
I'm developing a small app in C# (WinMo 6.x using VS2008), that toggles the bluetooth radio state, dependent on certain conditions, i.e. on when talking, or charging, off when not used etc.
I'm intercepting system events and use the openNETCF.Radio.RadioState to switch BT on and off.
Now, everything is fine so far, except that switching BT off is misbehaving sometimes (not allways). For example, if I end a call, BT is not switched off according to the Status icon, whereas the Radio.State in debugging tells me it is.
This is the code, I'm using, called by the event handlers and it's pretty much as in the SDF sample code:
private void BTOff()
{
foreach (IRadio radio in Radios.GetRadios())
{
if (radio is BluetoothRadio && radio.RadioState == RadioState.On)
radio.RadioState = RadioState.Off;
}
Thread.Sleep(200); //give it time to react
} //BTOff
Can anyone tell me what I'm doing wrong here or got a different solution for that?
Any help will be highly appreciated!
Cheers,
Thomas
Sorted
Even if there was no answer, thanks for reading and any effort put into my question.
Solution was to make the methods static and add a Radios.Refresh().
The program will be up in the blackstone forum, as soon as it's tested.
Cheers,
Thomas

Categories

Resources