Hello to all
I am working on windows7 64bit and I have a C# application that needs to read data from the spacenavigator.
Does any one have sample of C# code that reads the raw data?
Thank u in advance
Liora Rozenberg
How can I read spacenavigator data in C#
Moderator: Moderators
Please refer to the Raw Input API in C# topic.
c# example for reading the spacenavigator raw data
thank u for your reply.
I have already seen this article and even run the example on my comuter and when I touch the spacenavigator i succeeded to stop with breakpoint but how can i retrive the data?
I undestand that the data will come in the RAWHID struct but it contain only dwSizHid and dwCount
what structure should I add to the RAWHID struct so i could see the data ?
thank u for your replay
Liora
I have already seen this article and even run the example on my comuter and when I touch the spacenavigator i succeeded to stop with breakpoint but how can i retrive the data?
I undestand that the data will come in the RAWHID struct but it contain only dwSizHid and dwCount
what structure should I add to the RAWHID struct so i could see the data ?
thank u for your replay
Liora
You can find the code in the S3DM SDK sample used to decode the Raw Input packets. Refer to method CRawInputImplT::TranslateRawInputData() in the rawinput.hpp file.
You can download the SDK from the Software Developer page.
You can download the SDK from the Software Developer page.
Re: How can I read spacenavigator data in C#
Hi
I have the same problem in c#. Now I can read the raw data which is like "Data: 001 000 000 000 000 249 255 ". How can I translate that in C#? I couldn't find it in SDK. would you please give me more detail about it?
Regards
Bamshad
I have the same problem in c#. Now I can read the raw data which is like "Data: 001 000 000 000 000 249 255 ". How can I translate that in C#? I couldn't find it in SDK. would you please give me more detail about it?
Regards
Bamshad
Re: How can I read spacenavigator data in C#
001 indicates a translation vector. The next 6 bytes are the components in little-endian order. Combine them as such:bamshad wrote:Hi
I have the same problem in c#. Now I can read the raw data which is like "Data: 001 000 000 000 000 249 255 ". How can I translate that in C#? I couldn't find it in SDK. would you please give me more detail about it?
Regards
Bamshad
Code: Select all
public TranslationVector(byte xl, byte xh, byte yl, byte yh, byte zl, byte zh)
{
this.x = (int)(xl + (System.Int16)((System.Int16)xh << 8));
this.y = (int)(yl + (System.Int16)((System.Int16)yh << 8));
this.z = (int)(zl + (System.Int16)((System.Int16)zh << 8));
}
There is a WPF sample on our ftp site that shows how to do this: see this thread
Re: How can I read spacenavigator data in C#
Am I right with the assumption that the Data Above is a translation with 7 units against the Z-Axis?
Re: How can I read spacenavigator data in C#
That looks right to me. It is a signed two's complement number.devdev wrote:Am I right with the assumption that the Data Above is a translation with 7 units against the Z-Axis?