4

I'm trying to make in C # to allow the data traffic of the Cellular device (wwan) when the user clicks disable or when the windows starts letting it as "disabled" (in case a problem) , however I can only enable / disable the device.(hardware) The problem is that when enabling the device, it will not necessarily connect if the user click "disable" the cell phone as shown in the image below.

Tried with, WMI Win32_NetworkAdapter

And also with the new class MSFT_NetAdapter

But on both I can only enable / disable the device. So if the customer accidentally clicked turned off, it doesn't automatically reconnect.

Figure 1 Has the enabled device but the cellular option is disabled

Figure 1 Has the enabled device but the cellular option is disabled

Figure 2 What I want is enable and disable the cellular option like picture above.

Figure 2 What I want is enable and disable the cellular option like picture above.

NOTE: I am in .net framework 4.8 because I am doing a service for Windows.

NOTE¹: I tried to use the Xamarin library which I know has the capacity for this, but without success.

Resume:

How to enable cell phone traffic if the user has disabled it?

Tag: C #, C # Console

Community
  • 1
  • 1
Dorathoto
  • 201
  • 7
  • 17

3 Answers3

4

Microsoft has made a description on how to connect a mobile connection:

https://learn.microsoft.com/en-us/windows/iot-core/connect-your-device/mbb

and also released the code on github

https://github.com/ms-iot/iot-utilities/tree/master/MBBConnect

At least they invoke netsh mbn connect interface=Mobilfunk connmode=name name=GUID to connect the interface

To check state (enabled/disabled):

netsh mbn show radio interface=Mobilfunk

to enable:

netsh mbn set powerstate interface=Mobilfunk state=on
Thomas
  • 1,193
  • 1
  • 7
  • 16
2

If I got your question correct then you can try this as well, make a service to check for the bellow registry Key value and change it accordingly.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WwanSvc\GroupPolicy

Dword:

DisableWwanAutoConnect

Set the value to 1

You can also refer this

Bineesh John
  • 128
  • 6
0

There is a sample on how to turn on / off the Wifi and Bluetooth, but not for Cellular connection: https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/RadioManager

If you loop deeper, they are not available at the current version of Windows: https://learn.microsoft.com/en-us/uwp/api/windows.devices.radios.radiokind

MobileBroadband 2 A mobile broadband radio.

Note

This value is defined for future use and is not currently available.

Community
  • 1
  • 1
Hunter Tran
  • 13,257
  • 2
  • 14
  • 23