473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

[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 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:
- search all devices in
HKEY_LOCAL_MACHINE / System / CurrentControlSet / 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_MACHINE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash
- use "SetDevicePower" but I don't know <DEVICE_NAMEand Microsoft
discourages application developers from calling this function:
http://msdn2.microsoft.com/en-us/library/ms889607.aspx
- use "SetPowerRequirement" in this way:

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequirement
(
string pvDevice,
CEDEVICE_POWER_STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequirement(deviceName, deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlags = 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 SetPowerRequirement?

If I import the dll why I have to define CEDEVICE_POWER_STATE again in
C#???
Apr 27 '07 #1
4 10291
On Apr 27, 9:47 am, "BLUE" <bluewrote:
PsionWorkAboutProwith 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:

- search all devices in
HKEY_LOCAL_MACHINE / System / CurrentControlSet / 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_MACHINE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash

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

- use "SetPowerRequirement" in this way:

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequirement
(
string pvDevice,
CEDEVICE_POWER_STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequirement(deviceName, deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlags = 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 SetPowerRequirement?

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\PsionTeklogix\Bluetooth\PowerEnable = 0x1 (DWord)
Also in that Bluetooth section
resetdelay = 0x1388 (DWord)
baud = 0x1C200 (DWord)
name = "COM2:" (String)
driver = "bthuart.dll" (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.LocalMachine.Flush();

To reboot:

[DllImport("coredll.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(WinCEDeviceTypes.FILE_DEVICE_HAL,
WinCECTL_CODEFunctions.FUNCTION_REBOOT,
WinCEBufferMethodCodes.METHOD_BUFFERED,
WinCEKernelAccessors.FILE_ANY_ACCESS);

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

private static UInt32 CTL_CODE(WinCEDeviceTypes DeviceType,
WinCECTL_CODEFunctions Function, WinCEBufferMethodCodes Method,
WinCEKernelAccessors 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:
PsionWorkAboutProwith 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:

- search all devices in
HKEY_LOCAL_MACHINE / System / CurrentControlSet / 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_MACHINE/Comm I've found:
- an unknown CF8385PN1 device
- an Agere WLAGS46B1 WiFi compact flash

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

- use "SetPowerRequirement" in this way:

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr SetPowerRequirement
(
string pvDevice,
CEDEVICE_POWER_STATE DeviceState,
uint DeviceFlags,
IntPtr pvSystemState,
uint StateFlags
);

...
string deviceName = ...;
CEDEVICE_POWER_STATE deviceState = ...;
uint devFlags = POWER_NAME | POWER_FORCE;
SetPowerRequirement(deviceName, deviceState, devFlags, IntPtr.Zero, 0);

MSDN says "DeviceFlags = 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 SetPowerRequirement?

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
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...
3
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
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...
1
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, ...
1
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...
2
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...
0
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...
0
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...
2
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.