472,993 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Can I access USB HID on CE embedded from C#?

A bit of background. I have been asked to offer an independent
programming
study for high school students. I thought it would be really cool to
challenge
them with an embedded coding challenge on a embedded windows ce device.
I have a windows ce embedded device and development system up and
running. Now I want a practical example of an industrial control.
Reading
temperature from a USB device and displaying it in C# _seems_ like a
doable
project and very practical. I found a USB temperature probe that
supports HID
on ce.

http://www.toradex.com/e/usb_sensors.php

Below is the read me file. My question is can I call these methods from
C#? I
don't even know if C# on windows embedded supports PINVOKE. To put it
mildly I am a in a bit over my head here. Any answers appreciated.

Oak USB Sensor HID Driver for Windows CE 5.0
============================================

General
-------
The Oak USB Sensor HID Driver adds support for Toradex∆ USB Sensors to
Windows CE 5.0 operations systems. The driver provides a stream
interface
which allows using standard file system functions to access the device
such
as CreateFile, ReadFile, IOControl, and so on. Treating devices as
special files
is common to many operating systems. Serial ports traditionally have
been
represented by the COMx: special file names, similarly Oak USB Sensors
are
represented by the OAKx: special file names.

For more information about stream interface drivers please refere to
MSDN
documentation:
http://msdn2.microsoft.com/en-us/library/ms923745.aspx
Installation
------------
Copy and run the OakHidCE_v1.0.cab file on your Windows CE 5.0 target
system and choose an appropriate installation directroy. For persistent
driver
installation on Toradex∆ Colibri modules we recommend "\FlashDisk\" as
install dir.
Usage
-----
- Detect Oak sensor hot plugging by the events: OAK_ATTACH_EVENT and
OAK_DETACH_EVENT
(use GetEventData() to determine what sensor has been attached or
detached)

- Open sensor access: hOakDevice=CreateFile(L"OAKx:",....)

- Use/access sensor: ReadFile(hOakDevice,...)
DeviceIoControl(hOakDevice,IOCTL_OAK_...)

- Terminate sensor use: CloseHandle(hOakDevice)
Supported IOCTLs
----------------

- IOCTL_OAK_GET_INPUT_REPORT
- IOCTL_OAK_GET_FEATURE_REPORT
- IOCTL_OAK_SET_OUTPUT_REPORT
- IOCTL_OAK_SET_FEATURE_REPORT

- IOCTL_OAK_GET_INPUT_REPORT_LENGTH
- IOCTL_OAK_GET_OUTPUT_REPORT_LENGTH
- IOCTL_OAK_GET_FEATURE_REPORT_LENGTH

- IOCTL_OAK_GET_INPUT_VALUE_COUNT
- IOCTL_OAK_GET_OUTPUT_VALUE_COUNT

- IOCTL_OAK_GET_INPUT_VALUE_CAPS
- IOCTL_OAK_GET_OUTPUT_VALUE_CAPS

- IOCTL_OAK_GET_STRING_MANUFACT
- IOCTL_OAK_GET_STRING_PRODUCT
- IOCTL_OAK_GET_STRING_SERIAL
- IOCTL_OAK_GET_STRING_INDEXED

- IOCTL_OAK_GET_QUEUE_SIZE
- IOCTL_OAK_SET_QUEUE_SIZE

- IOCTL_OAK_GET_ACCESS_TIMEOUT
- IOCTL_OAK_SET_ACCESS_TIMEOUT

- IOCTL_OAK_GET_PRODUCT_ID
Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Jul 18 '08 #1
3 7031
On Jul 18, 10:26*am, Jeff Louie <anonym...@devdex.comwrote:
A bit of background. I have been asked to offer an independent
programming
study for high school students. I thought it would be really cool to
challenge
them with an embedded coding challenge on a embedded windows ce device.
I have a windows ce embedded device and development system up and
running. Now I want a practical example of an industrial control.
Reading
temperature from a USB device and displaying it in C# _seems_ like a
doable
project and very practical. I found a USB temperature probe that
supports HID
on ce.

http://www.toradex.com/e/usb_sensors.php

Below is the read me file. My question is can I call these methods from
C#? I
don't even know if C# on windows embedded supports PINVOKE. To put it
mildly I am a in a bit over my head here. Any answers appreciated.

Oak USB Sensor HID Driver for Windows CE 5.0
============================================

General
-------
The Oak USB Sensor HID Driver adds support for Toradex∆ USB Sensors to
Windows CE 5.0 operations systems. The driver provides a stream
interface
which allows using standard file system functions to access the device
such
as CreateFile, ReadFile, IOControl, and so on.

Yes, you can call them from C# via P/Invoke. I'm not sure what kind of
Windows you have - is it WinCE or WinNT/XP/Vista Embedded? Anyway,
either one supports P/Invoke, though CE has some limitations.

Jul 18 '08 #2
Hi Pavel... Thanks for the quick reply. I am programming WindowsCE
embedded
using VisualStudio2005onXP and transferring/running the programs to a CE
device over an intranet. With your encouragement I will go ahead and try
to
PINVOKE on CE.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Jul 18 '08 #3
This compiled and executed on a ce device. Deployment, execution and
debugging also worked over an intranet!

public class SomeClass
{
private uint OldCnt;
public SomeClass()
{
OldCnt = 0;
}
[DllImport ("coredll.dll")]
private static extern uint GetTickCount ();

public uint TicksSinceLast (){
uint ticks = GetTickCount();
uint diff = ticks - OldCnt;
OldCnt = ticks;
return diff;
}
}

public partial class Form1 : Form
{
private SomeClass sc = new SomeClass();
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "Hello World "+sc.TicksSinceLast();

}

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Jul 18 '08 #4

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

Similar topics

6
by: Moist | last post by:
Hi, I have an embedded HTML object as follows (ignore the code tag): <code> <object id="page" data="table.html" type="text/html" .... > </code> I look for the Javascript code (placed in...
1
by: Michael Palmer | last post by:
I'm reading xml from SQL Server 2K with VB.net using an XSD schema file and SQLXML 3.0. I have the below code working fine, but I'd like to change the code from reading the schema file from a...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
8
by: Colleyville Alan | last post by:
I have been working on an Access app that takes info from a file and writes it to a spreadsheet on a form, simultaneously saving the spreadsheet to Excel. I got the idea that the same concept...
59
by: Jeff Bowden | last post by:
For ease of configuration and other reasons, I would like for my single-user GUI app to be able to use postgresql in-process as a library accessing a database created in the users home directory. ...
4
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .......
0
by: thompson_38 | last post by:
I am using an embedded resource in a C# application that uses an axWebBrowser control to displays HTML pages. The resource dll is using C++. Using the res://mydll/homepage.htm, the home page...
41
by: Baron Samedi | last post by:
I want to produce a piece of software for embedded systems, generally telecoms based, mostly running on ARM processors, but I can't guarantee that, of course. My software should work along with...
0
by: partybob99 | last post by:
I dont know why this is so difficult for me, but I've looked literally everywhere on how to create a embedded crystal report in ASP.NET and then access it using the crystal report viewer. Here...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.