Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2007, 12:12 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem when reading data from a USB device

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[] theProductPacket = 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.ToInt32() == 0)
{
return "No Device Found";
}

// Sending Packet for starting asession
SendPackets(theProductPacket);

// Infinite loop for Data retreival
for (; ; )
{
// Getting one by one Packets
thePacket = GetPackets2();
if (Convert.ToInt32(thePacket.GetValue(0).ToString()) == 20 && Convert.ToInt32(thePacket.GetValue(4).ToString()) == 255)
{
break;
}
}

string Data = System.Text.ASCIIEncoding.ASCII.GetString(thePacke t, 4, thePacket.Length - 4);

bool bSuccess = CloseHandle(gHandle);


I am sure that I have to change following:
// Product data
byte[] theProductPacket = 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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem while reading data from COMM Port salman .NET Framework 2.0 0 November 21st, 2007 07:33 AM
problem in reading excel data premnaath ASP.NET 2.0 Professional 5 October 22nd, 2007 10:14 AM
.Net problem with emulated USb to Serial com port Turbovulc General .NET 0 April 5th, 2007 06:18 AM
Sending data to the audio-output device BrianWren VB How-To 2 January 11th, 2007 06:46 PM
Read data from USB san2308 General .NET 0 September 25th, 2006 08:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.