473,657 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[DESPERATE] Turn on/off Bluetooth, WiFi and an RFID tag reader.

Psion WorkAbout Pro with Windows CE .NET 4.2

Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader,
but I want to do it programmaticall y and do the same with WiFi and Bluetooth
as I can do from Control Panel ("Network and dialup connections" and
"Power").

Googling I've found that I should:
- search all devices in
HKEY_LOCAL_MACH INE / System / CurrentControlS et / Control / POWER /
State / {98C5250D-C29A-4985-AE5F-AFE5367E5006} / <DEVICE_NAME>

I've found no devices under POWER.
In Control Panel I've found that I've a Cambridge Silicon Bluetooth chip.
Under HKEY_LOCAL_MACH INE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash
- use "SetDevicePower " but I don't know <DEVICE_NAMEa nd Microsoft
discourages application developers from calling this function:
http://msdn2.microsoft.com/en-us/library/ms889607.aspx
- use "SetPowerRequir ement" in this way:

[DllImport("core dll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequire ment
(
string pvDevice,
CEDEVICE_POWER_ STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_ STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequire ment(deviceName , deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlag s = Bitwise-or of the following flags POWER_NAME,
POWER_FORCE".
This mean Bitwise-or of all the flags or Bitwise-or of the needed ones?

MSDN says "pvDevice Must be a valid LPWSTR device name, for example,
"COM1:". The actual meaning is determined by the DeviceFlags parameter."
As mentioned above for "SetDevicePower " I don't know <DEVICE_NAME> .
In which way DeviceFLags modify the meaning???

MSDN says "POWER_NAME specifies the name of the device whose power should
be maintained at or above the DeviceState level."
I've found in Pm.h that POWER_NAME is a DWORD whose value is 1:
how can it specify a name???
Maybe MSDN means that if I use POWER_NAME will be used the name of the
device that is calling SetPowerRequire ment?

If I import the dll why I have to define CEDEVICE_POWER_ STATE again in
C#???
Apr 27 '07 #1
4 10336
On Apr 27, 9:47 am, "BLUE" <bluewrote:
PsionWorkAboutP rowith Windows CE .NET 4.2

Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader,
but I want to do it programmaticall y and do the same with WiFi and Bluetooth
as I can do from Control Panel ("Network and dialup connections" and
"Power").

Googling I've found that I should:

- search all devices in
HKEY_LOCAL_MACH INE / System / CurrentControlS et / Control / POWER /
State / {98C5250D-C29A-4985-AE5F-AFE5367E5006} / <DEVICE_NAME>

I've found no devices under POWER.
In Control Panel I've found that I've a Cambridge Silicon Bluetooth chip.
Under HKEY_LOCAL_MACH INE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash

- use "SetDevicePower " but I don't know <DEVICE_NAMEa nd Microsoft
discourages application developers from calling this function:
http://msdn2.microsoft.com/en-us/library/ms889607.aspx

- use "SetPowerRequir ement" in this way:

[DllImport("core dll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequire ment
(
string pvDevice,
CEDEVICE_POWER_ STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_ STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequire ment(deviceName , deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlag s = Bitwise-or of the following flags POWER_NAME,
POWER_FORCE".
This mean Bitwise-or of all the flags or Bitwise-or of the needed ones?

MSDN says "pvDevice Must be a valid LPWSTR device name, for example,
"COM1:". The actual meaning is determined by the DeviceFlags parameter."
As mentioned above for "SetDevicePower " I don't know <DEVICE_NAME> .
In which way DeviceFLags modify the meaning???

MSDN says "POWER_NAME specifies the name of the device whose power should
be maintained at or above the DeviceState level."
I've found in Pm.h that POWER_NAME is a DWORD whose value is 1:
how can it specify a name???
Maybe MSDN means that if I use POWER_NAME will be used the name of the
device that is calling SetPowerRequire ment?

If I import the dll why I have to define CEDEVICE_POWER_ STATE again in
C#???
Hi,

This is what I use, although you could also register as a developer at
PsionTeklogic's Teknet and download the SDK, that has lots of control
libraries.

Make this registry change (I use the OpenNETCF libraries)

HKLM\Drivers\Ps ionTeklogix\Blu etooth\PowerEna ble = 0x1 (DWord)
Also in that Bluetooth section
resetdelay = 0x1388 (DWord)
baud = 0x1C200 (DWord)
name = "COM2:" (String)
driver = "bthuart.dl l" (String)

Check for those settings at application load and reboot if you need to
change any of them.
If you use OpenNETCF, don't forget to call
Registry.LocalM achine.Flush();

To reboot:

[DllImport("core dll.dll")]
internal static extern bool KernelIoControl (UInt32 dwIoControlCode ,
IntPtr lbInBuf, UInt32 nInBufSize, ref IntPtr lpOutBuf, ref UInt32
nOutBufSize, ref IntPtr lpBytesReturned );

public static void WarmReset()
{
IntPtr lpOutBuf = IntPtr.Zero;
UInt32 nOutBufSize = 0;
IntPtr lpBytesReturned = IntPtr.Zero;
UInt32 dwIocontrolCode = 0;

dwIocontrolCode = CTL_CODE(WinCED eviceTypes.FILE _DEVICE_HAL,
WinCECTL_CODEFu nctions.FUNCTIO N_REBOOT,
WinCEBufferMeth odCodes.METHOD_ BUFFERED,
WinCEKernelAcce ssors.FILE_ANY_ ACCESS);

KernelIoControl (dwIocontrolCod e, IntPtr.Zero, 0, ref lpOutBuf, ref
nOutBufSize, ref lpBytesReturned );
}

private static UInt32 CTL_CODE(WinCED eviceTypes DeviceType,
WinCECTL_CODEFu nctions Function, WinCEBufferMeth odCodes Method,
WinCEKernelAcce ssors Access)
{
return (uint) DeviceType << 16 | (uint) Access << 14 | (uint)
Function << 2 | (uint) Method;

}

Regards,

James Neave.

May 1 '07 #2
On Apr 27, 9:47 am, "BLUE" <bluewrote:
PsionWorkAboutP rowith Windows CE .NET 4.2

Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader,
but I want to do it programmaticall y and do the same with WiFi and Bluetooth
as I can do from Control Panel ("Network and dialup connections" and
"Power").

Googling I've found that I should:

- search all devices in
HKEY_LOCAL_MACH INE / System / CurrentControlS et / Control / POWER /
State / {98C5250D-C29A-4985-AE5F-AFE5367E5006} / <DEVICE_NAME>

I've found no devices under POWER.
In Control Panel I've found that I've a Cambridge Silicon Bluetooth chip.
Under HKEY_LOCAL_MACH INE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash

- use "SetDevicePower " but I don't know <DEVICE_NAMEa nd Microsoft
discourages application developers from calling this function:
http://msdn2.microsoft.com/en-us/library/ms889607.aspx

- use "SetPowerRequir ement" in this way:

[DllImport("core dll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequire ment
(
string pvDevice,
CEDEVICE_POWER_ STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_ STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequire ment(deviceName , deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlag s = Bitwise-or of the following flags POWER_NAME,
POWER_FORCE".
This mean Bitwise-or of all the flags or Bitwise-or of the needed ones?

MSDN says "pvDevice Must be a valid LPWSTR device name, for example,
"COM1:". The actual meaning is determined by the DeviceFlags parameter."
As mentioned above for "SetDevicePower " I don't know <DEVICE_NAME> .
In which way DeviceFLags modify the meaning???

MSDN says "POWER_NAME specifies the name of the device whose power should
be maintained at or above the DeviceState level."
I've found in Pm.h that POWER_NAME is a DWORD whose value is 1:
how can it specify a name???
Maybe MSDN means that if I use POWER_NAME will be used the name of the
device that is calling SetPowerRequire ment?

If I import the dll why I have to define CEDEVICE_POWER_ STATE again in
C#???
Hi,

Another quick point, I found all this out by the following process:

1) Install embedded visual C++ 4 and all relevant service packs and
psion SDKs
2) Set the Bluetooth OFF
3) Take a copy of the CR Registry using the eVC++ Remote Registry
editor
4) Set the Bluetooth ON
5) Take a second copy of the Registry
6) Compare the to *.reg files using a text comparing application (I
use KDiff3)
7) Write code to make those registry changes progamatically.

Should work for the RFID and WiFi too.

Regards,

James Neave.

May 1 '07 #3
Do you know if there is an api call monitor for handheld devices?
It would be helpful for discovering how control panel manages to turn on/off
things.

Thanks for your tips!
May 1 '07 #4
On May 1, 2:51 pm, "BLUE" <bluewrote:
Do you know if there is an api call monitor for handheld devices?
It would be helpful for discovering how control panel manages to turn on/off
things.

Thanks for your tips!
Your welcome,

I don't know of anything specific for that task but there are lots of
tools built into eVC++ 4.0.
It would be bloody handy wouldn't it?
As it happens that's the only way I've ever been able to control
things on the WPro. It's effective but requires that reboot.
You can also control the security mode and lock out "dangerous" keys
on the keyboard.
I write kiosk applications, so I don't want people to be able to get
to the Start menu (disable blue+".")

Regards,

James Neave.

May 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2273
by: Thomas_Germany | last post by:
I would like to develop a smart device bluetooth application for pocket PC 2003. As I know, Pocket PC 2003 includes the microsoft bluetooth stack. My intention is to use the SDK from mircrosoft and not the expensive SDK from WIDCOMM to use the bluetooth programming interfaces. But, as I know most pocket PCs with integrated bluetooth chips use the WIDCOMM bluetooth stack. So my questions are as follows: 1) Is it possible to...
3
8041
by: Tor Erik Sønvisen | last post by:
Hi I'm making a server-side solution in Python and need to be able to communicate through bluetooth. Is there any bluetooth-packages out there for python? regards tores
2
7094
by: kies | last post by:
Hi all, I'm currently trying to create an application that make use of the RFID technology and i'm not too sure how to get about using the RFID. I was wondering if any of you guys know of any good reasources about using RFID, like how do i capture the tag ID using the reader and passing it into my application. Thanks.
1
2260
by: broadbandera | last post by:
RFID Technology and Architecture, RFID Standards,RFID Applications, RFID Security, Impact of RFID Tags on Recycling, Environmental Challenges of RFID, RFID Tags: Advantages and Limitations, http://flying-rugs.com/rfid-tutorial/
1
3123
by: Peter Hansen | last post by:
Im on a RFID application, in have a lot of problems, which I hope you kan help me with. Sourcefiles: http://www.ti.com/rfid/docs/manuals/softwares/DLL.zip Documentation http://www.ti.com/rfid/docs/manuals/refmanuals/S6000ProgramLibraryFECOM.pdf og http://www.ti.com/rfid/docs/manuals/refmanuals/S6000ProgramLibraryFEISC.pdf
2
7280
by: rsaikamesh | last post by:
Hi, I have connected RFID printer(Zebra R2844-Z) to the serial port(dev/ttyS0). My OS is linux(ubuntu). I need to read the RFID tag using a c++ program.I don't know anything about how to read RFID tags.I don't even have a clue. so please help me.If possible send me an example code, otherwise please atleast give me some clues.
0
398
by: BLUE | last post by:
Psion WorkAbout Pro with Windows CE .NET 4.2 Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader, but I want to do it programmatically and do the same with WiFi and Bluetooth as I can do from Control Panel ("Network and dialup connections" and "Power"). Googling I've found that I should:
0
4135
by: BLUE | last post by:
I'll let you know what the dealer and the manufacturer will answer me as soon as possible. As far as now I've been capable or turning ON/OFF: - the RFID reader using dealer supplied executables (PowerAPIon/off.exe) - CF WiFi and any other expansion card using "Psion Mobile Devices SDK"
2
4150
by: VictorTan | last post by:
Hello. I'm new to this forum. Hope that I don't make mistakes in here but if I do, please correct me if there is. Thanks. I also wanted to ask you guys regarding about the following following source codes I'm going to post it here as I did a search here and did not find any question related to mine. I'm doing an automatic inventory control system using RFID project and I'm instructed to extract the RFID transponder's ID and CRC and display...
1
1622
by: Airwolf | last post by:
Hi All, I am wondering if it is possible to develop software for a Symbol XR400 RFID reader connected via IP. Im scoping a project out for somebody and and wondering where to start, the Development kits from their website seem to only have C++ headers and the like. Any help would be very much appreciated, as i say i just dont know where to start, even some sample software code would be good at this point. Thanks
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.