From: Simon Neve on
It worked! Seems like I wasn't calling the .Load function on the
LINEDEVSTATUS object. Thanks very much Alex and Peter, it saved me a week of
work - appreciate it.

(for anybody wanting to use the code below, i had to change:

for( int i= 0; i < lineNo; i++)
.... for ...
for( int i= 0; i < tapi.NumDevices; i++)

)

"Alex Feinman [MVP]" wrote:

> Here is roughly what you want to do:
>
> Tapi tapi = new Tapi();
>
> int lineNo = tapi.Initialize();
>
> Line line = null;
>
> for( int i= 0; i < lineNo; i++)
>
> {
>
> LINEDEVCAPS dc;
>
> if ( tapi.GetDevCaps(i, out dc) == 0 )
>
> {
>
> if ( dc.ProviderName == CellTSP.CELLTSP_PROVIDERINFO_STRING )
>
> {
>
> line = tapi.CreateLine(i, LINEMEDIAMODE.INTERACTIVEVOICE,
> LINECALLPRIVILEGE.NONE);
>
> }
>
> }
>
> }
>
> if ( line != null )
>
> {
>
> LINEDEVSTATUS status = new LINEDEVSTATUS(1024);
>
> status.Store();
>
> NativeTapi.lineGetLineDevStatus(line.hLine, status.Data);
>
> status.Load();
>
> label1.Text = "Signal strength is: " + status.dwSignalLevel.ToString();
>
> }
>
> line.Dispose();
>
> tapi.Shutdown();
>
>
> --
> Alex Feinman
> ---
> Visit http://www.opennetcf.org
> "Simon Neve" <SimonNeve(a)discussions.microsoft.com> wrote in message
> news:D7709589-6834-4EB8-87F0-D9ABD01CBFDA(a)microsoft.com...
> > That was exactly what we needed - thanks.
> >
> > Unfortunately, I tried calling the function lineGetLineDevStatus in the
> > MakeCall function but it returned no line related data at all. I've
> > posted
> > the code below, but unless there's anything you can see that I'm doing
> > wrong,
> > it's back to the RIL via C++ i guess?
> >
> > Thanks,
> > Simon
> >
> >
> >
> > public Call MakeCall(string Destination, int CountryCode,
> > /*LINECALLPARAMS*/
> > byte[] Params)
> > {
> > IAsyncResult ar = BeginMakeCall(Destination, CountryCode, Params, null,
> > null);
> > bSyncMakeCall = true;
> > MakeCallAsyncResult mc = ar as MakeCallAsyncResult;
> > bool bDone = false;
> > while ( !bDone )
> > {
> > Monitor.Enter(mc);
> > if ( mc.IsCompleted )
> > bDone = true;
> > Monitor.Exit(mc);
> > Application.DoEvents();
> > }
> > // if ( !(ar as MakeCallAsyncResult).IsCompleted )
> > // ar.AsyncWaitHandle.WaitOne();
> >
> > // Start spn code changes
> > int i = Marshal.SizeOf(typeof(LINEDEVSTATUS));
> >
> > LINEDEVSTATUS lds = new
> > LINEDEVSTATUS(Marshal.SizeOf(typeof(LINEDEVSTATUS)));
> > byte[] data = new byte[Marshal.SizeOf(typeof(LINEDEVSTATUS))];
> >
> > NativeTapi.lineGetLineDevStatus(m_hLine, data);
> >
> > ByteCopy.ByteArrayToStruct(data, lds);
> >
> > MessageBox.Show(lds.dwSignalLevel.ToString());
> >
> > // End spn code changes
> >
> > Call call = EndMakeCall(ar);
> > return call;
> > }
> >
> > "Peter Foot [MVP]" wrote:
> >
> >> You can use TAPI from .NET - see Alex's wrapper:-
> >> http://www.alexfeinman.com/download.asp?doc=tapi1.1.zip
> >>
> >> A NotSupportedException probably indicates an incorrect type passed when
> >> P/Invoking, commonly passing a long instead of an int (In .NET long is
> >> 64bits). If you post your code for the specific method which is causing
> >> you
> >> problems we can take a look - but you may find it's already implemented
> >> in
> >> the above.
> >>
> >> Peter
> >>
> >> --
> >> Peter Foot
> >> Windows Embedded MVP
> >> www.inthehand.com | www.opennetcf.org
> >>
> >> "Simon Neve" <SimonNeve(a)discussions.microsoft.com> wrote in message
> >> news:361959FF-8889-47B0-ACCC-890A70FD659A(a)microsoft.com...
> >> > Hello,
> >> >
> >> > We're trying to retrieve GRPS signal strength on an XDA device (running
> >> > PPC2003 phone edition). We started to look at the OpenNETCF.Net but
> >> > that
> >> > seems to return signal strength for RF cards only. So our research
> >> > tells
> >> > us
> >> > we can use TAPI API's or use RIL. We've tried using TAPI but keep
> >> > getting
> >> > a
> >> > 'NotSupportedException'. Before we spend days relearning eVC++, is
> >> > there
> >> > a
> >> > way of getting signal strength using .Net? Can we call RIL functions
> >> > from
> >> > within .Net?
> >> >
> >> > Thanks in advance,
> >> >
> >> > Simon Neve
> >>
> >>
> >>
>
>