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

Home Posts Topics Members FAQ

Problem reading data from an USB device

2 New Member
Dear All,
I am developing an application in C#. This application communicates with Garmin Forerunner device. I have developed a demo for it, which shows Device software version. but I am not able to get Device history Data. What should I pass for getting history data.

Below is the code sample which I am using for fetching device information:

// Product data
byte[] theProductPacke t = new byte[] { 20, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0 };

byte[] thePacket = new byte[] { };

// For initializing device
initDevice();

//Checking for device availability
if (gHandle.ToInt3 2() == 0)
{
return "No Device Found";
}

// Sending Packet for starting asession
SendPackets(the ProductPacket);

// Infinite loop for Data retreival
for (; ; )
{
// Getting one by one Packets
thePacket = GetPackets2();
if (Convert.ToInt3 2(thePacket.Get Value(0).ToStri ng()) == 20 && Convert.ToInt32 (thePacket.GetV alue(4).ToStrin g()) == 255)
{
break;
}
}

string Data = System.Text.ASC IIEncoding.ASCI I.GetString(the Packet, 4, thePacket.Lengt h - 4);

bool bSuccess = CloseHandle(gHa ndle);


I am sure that I have to change following:
// Product data
byte[] theProductPacke t = new byte[] { 20, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0 };

I am not asking for providing code, but if anyone can post approach for it then it will be highly appreciated.
Aug 4 '07 #1
0 1716

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1742
by: Eric Lilja | last post by:
Hello, I have a text file that contains a number of entries describing a recipe. Each entry consists of a number of strings. Here's an example file with only one entry (recipe): Name=Maple Quill Process=Interim Level=10 Technique=Fletching Knowledge=Woodworking Device=Sawhorse Primary components=Refined Maple
2
4085
by: ArmedCoder | last post by:
Hi, im just learning about multithreading for a program i am writin that needs to read from multiple camreas attached to the computer a the same time. I know how to create threads and pass around info, and i know a bi about mutexes but this is not where the problem resides. Every time the thread goes to open the device at /dev/video* the threa just stops running as far as i can see. i put printf's all over the place and it prints right...
3
4743
by: Gregory Graham | last post by:
I have a temperature sensor device we use to shutdown our servers. It relys on fopen() blocking when the serial port device isn't ready. Unfortunately that's not what's happening. The fopen() returns immediately without an error. What have I got wrong? Basically when it gets too hot the device connects the 8 and 6 lines to line 20. That should, as I understand it, tell the fopen() that the file is available and cause the rest of the...
10
4008
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
9
3597
by: Macca | last post by:
Hi, I have a synchronous socket server which my app uses to read data from clients. To test this I have a simulated client that sends 100 byte packets. I have set up the socket server so that its buffer is bigger than this. I did this expecting the data to be read in one pass.
1
3006
by: kameswara | last post by:
Hi folks , Can anyone help me out the problem regarding writing and reading data to/from a serial device like ttyS0 in linux . Writing is being done but unable to read from it . could u plea help me out with good stuff or brief explation what i need to do . Remember i need asynchronous read/write opeartion where i m using aio_read and aio_write.
6
11902
by: John Wright | last post by:
I am trying to read the data from a device on a serial port. I connect just fine and can receive data fine in text mode but not in binary mode. In text mode the data from the device comes in like this: S~5BBBBBBBBBBBBBBB5BBBBBBBB5B31BB4BB2B5BB4BBBE S is the start of the line, ~ indicates a good read, B is a blank reading, and the numbers 1-6 correspond to a location on the device for a line. So there are six positions on the line...
2
2871
by: Jassim Rahma | last post by:
I have a medical device which has an infrared and i want to know how can i read data from it using the infrared/
9
14385
by: Hal Vaughan | last post by:
I've done a fair amount of Googling for information on reading the serial port in C++ (and in Linux). Unfortunately, out of every 4 hits, 1 seems to be an unanswered question, 1 is someone saying, "That's easy, there's a lot out there, Google it,", 1 is a discussion on it without examples and the other is who knows what. I did find some info on it and have been experimenting. The one example that I liked the best in terms of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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
8723
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
8502
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
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
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
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.