Get Cellular Signal Strength

aerohost

Member
Licensed User
Hi, does anyone know how to get the cell signal strength data from wm6? I want to make a big display that shows the numerical field strength value that I see on the field service screen of my CDMA HTC Touch phone (WM6 Pro). The usual tiny bar graph at the top is too small, doesn't update fast enough, and doesn't have enough resolution.

Tks, AB
 

taximania

Well-Known Member
Licensed User
Longtime User

Attachments

  • signal.zip
    2.2 KB · Views: 203
Last edited:

aerohost

Member
Licensed User
Hi Taximania, thanks very much for that. It worked on my HTC Touch - at least, I got a number to appear. Do you know which CDMA parameter you are actually monitoring? I have these relevant items on my field test screen (with example values):

Rx Power 69 dbm
Rx Ec/Io 63 db

Neither of these seemed to be the number that popped up from your program; is it just displaying some kind of relative reading?

Also, I tried to make it refresh the display (using a text label on the form) as I move around, but using the sleep(xxx) command seems to make it lock up. Is there something wrong with this code?
===========
Sub App_Start
Form1.show
si.New1

Msgbox("start")

For i = 1 To 1000

Signal.Text = i
Sleep(300)
Signal.Text = si.SignalStrength

Next

End Sub
==============
Tks, AB
 

agraham

Expert
Licensed User
Longtime User
Is there something wrong with this code?
Yes, by sitting in a loop you are not letting the application return to the message loop where it processes messages which cause the user interface elements to be redrawn. You can crudely overcome this with "DoEvents" which causes the message loop to run

B4X:
For i = 1 To 1000
  ....
  DoEvents
Next
However this is not good practice in an event-driven environment. You should really start a timer and update your display in the timer tick. Also I don't know what you intend by "Signal.Text = i" unless it slipped in while testing.
 

taximania

Well-Known Member
Licensed User
Longtime User
B4X:
Sub App_Start
Form1.show
si.New1

Msgbox("start")

For i = 1 To 1000

Signal.Text = i
Sleep(300)
Signal.Text = si.SignalStrength

Next

End Sub


I don't understand why you are coding a loop.
Use a timer to update a control.
Add timer1 to form1.
Add Label1 as well.

B4X:
Sub Globals
End Sub

Sub App_Start
Form1.show
si.New1
timer1.Interval=500
timer1.Enabled=true
End Sub

Sub Timer1_Tick
label1.Text=si.SignalStrength

End Sub

This code updates label1.text every 500 mls

It's difficult to prove it works sat here. I've got a 100% signal.
It actually dropped to 94 a minute ago.
So I presume it is working.
 
Last edited:

aerohost

Member
Licensed User
Thanks to you both! I haven't used PPC for a while and forgot about the timer. Still, I wonder why the other approach causes it to crash.

Taximania, I'm still wondering what exactly we are monitoring with this ...

Regards, AB
 

taximania

Well-Known Member
Licensed User
Longtime User
The code I provided is still running on my PPC.
Just for the laugh.

Last timeI looked, its reading:
90% signal.
81% battery power.

I added the Battery meter reading to the dll but I've not
updated the zip in #1 yet.

Now it's 100% signal with 81% battery.

Now it's 98% signal with 81% battery.

Now it's 90% signal with 81% battery.

Now it's 100% signal with 81% battery.

Now dipped to 94% signal 81% Battery.

I'll kill the lApp later, and post the results tomorrow morning.
Currentle 94,81
 

taximania

Well-Known Member
Licensed User
Longtime User
Thanks to you both! I haven't used PPC for a while and forgot about the timer. Still, I wonder why the other approach causes it to crash.

Taximania, I'm still wondering what exactly we are monitoring with this ...

Regards, AB


I'm using the WN6 windowsmobile. etc etc etc dll's
The info may be debatable !

I'm going to bed now :sign0060:

I just hope i've managed to give some help to someone tonight.
 

aerohost

Member
Licensed User
Hi Taximania:

So I got it to work with the timer, thanks to you and agraham.

But, I think whatever parameter you're reading works differently on my phone. Essentially, it looks like all it's doing is monitoring how many bars are showing on my regular signal strength meter at the top of the screen.

All I get is values of 34, 66, and 94 which appear to correspond to the 2, 3, and 4 bars on my regular signal strength meter at the top. It also only updates when the bar meter changes, which is much less often than the 500 msec of the timer.

This confirms my suspicion that it's simply reading the bar value, especially since there are never any values in between the ones I noted above.

Any ideas on this? I'm wondering what you meant when you said

"I'm using the WN6 windowsmobile. etc etc etc dll's"

Could you tell me what these are?

Is their some other parameter that could be monitored with your dll that would show the actual continuous change in strength, like what is available in the field service screen?

I'm using this to peak my external yagi antenna as I cruise up and down the Pacific coast on my sailboat, and I need to be able to see it in big fonts from a distance. That big font part is working great, but I need more 'granularity' than what the bar meter yields.

Tks, AB

Thanks, AB
 

taximania

Well-Known Member
Licensed User
Longtime User
I've found that using Microsoft.WindowsMobile.Status.dll directly
from within B4ppc added as a component, and SystemState
added as an object, gives you direct access to the SignalStrength property.

Lot's of other info can be gained from the Microsoftblablabla.dll's as long as the New1 option is available to B4ppc

Hope I'm not stating the BO, just sharing info :)
 

Attachments

  • signal2.zip
    17.8 KB · Views: 168
Last edited:

eww245

Member
Licensed User
Ive been using the registry to get signal strength.

B4X:
Sub Signal
     sig = reg.GetValue ("System\State\Phone","Signal Strength Raw")

   If sig >= 95 Then
      ImageButton1.Image = ImageList3.Item(5)
   Else If (sig >= 75) AND (sig <95) Then
      ImageButton1.Image = ImageList3.Item(4)
  Else If (sig >= 45) AND (sig <75) Then
      ImageButton1.Image = ImageList3.Item(3)
   Else If (sig >= 20) AND (sig <45) Then
      ImageButton1.Image = ImageList3.Item(2)
   Else If (sig >= 5) AND (sig <20) Then
      ImageButton1.Image = ImageList3.Item(1)
   Else If (sig >= 0)  AND (sig <5) Then
      ImageButton1.Image = ImageList3.Item(0)
   End If
ImageButton1.Visible = True
End Sub
 
Top