|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: recieve data from cRIO
Thanks! now we can see something, it looks like ?M? for each packet, and changes to variations of that, ?p? ?r? ??? etc... changing the encoding changes the ? to other chars, but it looks weird (wiresharks verifies that our custom packet works, and looks normal there)
|
|
#2
|
||||
|
||||
|
Re: recieve data from cRIO
Quote:
Code:
Dim reader As New BinaryReader(New MemoryStream(data))
reader.ReadBytes(26) 'Skip the automatically sent data (team number, battery, DS in/outs, etc.)
SequenceNumber = reader.ReadByte()
Dim printedString = New String(Text.Encoding.ASCII.GetChars(reader.ReadBytes(reader.EReadUInt32())))
Me.PrintedString.Add(printedString)
Dim errorString = New String(Text.Encoding.ASCII.GetChars(reader.ReadBytes(reader.EReadUInt32())))
Me.ErrorStrings.Add(errorString)
Dim dataSize = reader.EReadUInt32()
Dim userData As Byte() = reader.ReadBytes(dataSize)
Code:
Imports System.IO
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.Runtime.CompilerServices
Public Module BinaryReaderExtensions
<Extension()> _
Public Function EReadUInt32(ByVal reader As BinaryReader) As UInt32
Dim bytes = reader.ReadBytes(4)
Return bytes(0) * 255 ^ 3 + bytes(1) * 255 ^ 2 + bytes(2) * 255 ^ 1 + bytes(3)
End Function
<Extension()> _
Public Function EReadUInt16(ByVal reader As BinaryReader) As UInt16
Dim bytes = reader.ReadBytes(2)
Return bytes(0) * 255 ^ 1 + bytes(1)
End Function
End Module
|
|
#3
|
||||
|
||||
|
Re: recieve data from cRIO
Thanks, but i figured it out:
(in C#.net just to irritate you VB bigot) Code:
buffer= client.Receive...
string endresult = "";
foreach (byte databit in buffer)
{
endresult+=((buffer==0)?"":((char)databit).ToString());//I love () to make sure thigs execute as i want (as well as ; semicolins;)
}
textBox1.Text+="\n"+endresult;
?hs\0546d\0jos\0MYDATAHERE\0jsfjnn\0 and it cut off after the \0 (or null (buffer = 0) (Nothing for you VB bigot)) i just had to set a breakpoint, see the data, and realize what was happening (the string was being chopped up!); |
|
#4
|
||||
|
||||
|
Re: recieve data from cRIO
Something very useful for feedback is the ability to write to the LCD of your DriverStation: http://thinktank.wpi.edu/article/144
|
|
#5
|
||||
|
||||
|
Re: recieve data from cRIO
Quote:
|
|
#6
|
||||
|
||||
|
Re: recieve data from cRIO
All that is great, as long as you have a laptop around.
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data delay between Crio and DS | Tom Line | NI LabVIEW | 9 | 17-02-2009 08:40 |
| Capture Data from the cRio | goodsky | Programming | 2 | 13-01-2009 21:27 |
| Sending data from RC to OI | Nathan | Programming | 7 | 03-02-2008 22:32 |
| Did we recieve MS Front Page from FIRST | Mr.G | Website Design/Showcase | 2 | 28-01-2006 15:12 |
| Programming Vex Starter Kit To Recieve From Serial Port | firetrap | FIRST Tech Challenge | 0 | 26-09-2005 17:27 |