Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial discovery stuff

  • Loading branch information...
commit 840cfcb3e8213499173a8db00854c7351e73d3cc 1 parent 8ce4914
@dchap dchap authored
Showing with 111 additions and 13 deletions.
  1. BIN  ConsoleServerRunner/ConsoleServerRunner.v11.suo
  2. +29 −0 ConsoleServerRunner/ConsoleServerRunner/bin/Release/2012102401-condiscon.txt
  3. +42 −0 ConsoleServerRunner/ConsoleServerRunner/bin/Release/2012102401-firstrun.txt
  4. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/ConsoleServerRunner.exe
  5. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/ConsoleServerRunner.pdb
  6. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/Receiver.dll
  7. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/Receiver.pdb
  8. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/SerialPortSlice.dll
  9. BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/SerialPortSlice.pdb
  10. BIN  ConsoleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.csprojResolveAssemblyReference.cache
  11. BIN  ConsoleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.exe
  12. BIN  ConsoleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.pdb
  13. +36 −9 SerialPortComponents/Receiver/Receiver.cs
  14. BIN  SerialPortComponents/Receiver/bin/Release/Receiver.dll
  15. BIN  SerialPortComponents/Receiver/bin/Release/Receiver.pdb
  16. BIN  SerialPortComponents/Receiver/obj/Release/Receiver.dll
  17. BIN  SerialPortComponents/Receiver/obj/Release/Receiver.pdb
  18. +3 −3 SerialPortComponents/SerialPortSlice/SerialPortService.cs
  19. BIN  SerialPortComponents/SerialPortSlice/bin/Release/Receiver.dll
  20. BIN  SerialPortComponents/SerialPortSlice/bin/Release/Receiver.pdb
  21. BIN  SerialPortComponents/SerialPortSlice/bin/Release/SerialPortSlice.dll
  22. BIN  SerialPortComponents/SerialPortSlice/bin/Release/SerialPortSlice.pdb
  23. +1 −1  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.csproj.FileListAbsolute.txt
  24. BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.csprojResolveAssemblyReference.cache
  25. BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.dll
  26. BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.pdb
  27. BIN  SerialPortComponents/ServerComponents.v11.suo
  28. BIN  docs/diagrams/AddRemoveReceiverWithConfig.PNG
View
BIN  ConsoleServerRunner/ConsoleServerRunner.v11.suo
Binary file not shown
View
29 ConsoleServerRunner/ConsoleServerRunner/bin/Release/2012102401-condiscon.txt
@@ -0,0 +1,29 @@
+(event) Serial port servicer starting.
+(event) (COM3)(receiver note) command preamble: *450052.0#16,
+(event) (COM3)(receiver note) read: *450052.0#16[0014],0811,OK,#90
+*450052.0#16[0014],INVALID,#07
+*450052.0#16[0014],0811,OK,#90
+
+(event) (COM3)Read: *450052.0#16[0009],OK,#9A
+*450052.0#16[0009],OK,#9A
+
+(event) Receiver on COM3
+(event) Receiver on COM3 removed.
+(event) (COM3)(receiver note) command preamble: *450052.0#16,
+(event) (COM3)(receiver note) read: *450052.0#16[0014],0811,OK,#90
+*450052.0#16[0014],0811,OK,#90
+*450052.0#16[0014],INVALID,#07
+
+(event) (COM3)Read: *450052.0#16[0009],OK,#9A
+*450052.0#16[0009],OK,#9A
+
+(event) Receiver on COM3
+(event) 450052,000,2012-10-25 00:30:58,STS,DC=325,PC=3064,LV=0.0,BV=3.2,BU=4.5,I=2.7,T=21.1,DU=0.1,RU=0.2,XYZ=-0.03:-0.16:-0.97,#BC from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,001,2012-10-25 00:30:33,A69-1601,31620,#B6 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,002,2012-10-25 00:30:47,A69-1601,31620,#BC from receiver on COM3
+(event)
+ from receiver on COM3
View
42 ConsoleServerRunner/ConsoleServerRunner/bin/Release/2012102401-firstrun.txt
@@ -0,0 +1,42 @@
+(event) Serial port servicer starting.
+(event) (COM3)(receiver note) command preamble: *450052.0#16,
+(event) (COM3)(receiver note) read: *450052.0#16[0014],INVALID,#07
+
+(event) Receiver on COM3
+(event) *450052.0#16[0014],0811,OK,#90 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) *450052.0#16[0009],OK,#9A from receiver on COM3
+(event)
+ from receiver on COM3
+(event) *450052.0#16[0009],OK,#9A from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,000,2012-10-25 00:24:57,STS,DC=302,PC=2872,LV=0.0,BV=3.2,BU=4.5,I=2.7,T=21.1,DU=0.1,RU=0.2,XYZ=-0.03:-0.16:-0.97,#BF from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,001,2012-10-25 00:24:41,A69-1601,31620,#B8 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,002,2012-10-25 00:24:56,A69-1601,31620,#BF from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,003,2012-10-25 00:25:11,A69-1601,31620,#B8 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,004,2012-10-25 00:25:25,A69-1601,31620,#BE from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,005,2012-10-25 00:25:40,A69-1601,31620,#BC from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,006,2012-10-25 00:25:55,A69-1601,31620,#C3 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,007,2012-10-25 00:25:57,STS,DC=306,PC=2904,LV=0.0,BV=3.2,BU=4.5,I=2.7,T=21.2,DU=0.1,RU=0.2,XYZ=-0.03:-0.16:-0.97,#C8 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) 450052,008,2012-10-25 00:26:09,A69-1601,31620,#C5 from receiver on COM3
+(event)
+ from receiver on COM3
+(event) Receiver on COM3 removed.
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/ConsoleServerRunner.exe
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/ConsoleServerRunner.pdb
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/Receiver.dll
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/Receiver.pdb
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/SerialPortSlice.dll
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/bin/Release/SerialPortSlice.pdb
Binary file not shown
View
BIN  ...oleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.csprojResolveAssemblyReference.cache
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.exe
Binary file not shown
View
BIN  ConsoleServerRunner/ConsoleServerRunner/obj/Release/ConsoleServerRunner.pdb
Binary file not shown
View
45 SerialPortComponents/Receiver/Receiver.cs
@@ -29,7 +29,7 @@ public class Receiver
private SerialPort serialPort { get; set; }
private dynamic receiverConfig = null;
private int firmwareVersion { get; set; }
- private string commandPreamble { get; set; }
+ private String commandPreamble { get; set; }
private TextReader textReader { get; set; }
private int goState = 1;
private static char[] crlf = new char[2] { '\x0D', '\x0A' };
@@ -94,19 +94,46 @@ public Receiver(SerialPort serialPort, String portName, Dispatcher dispatcher)
public int INFO()
{
+ String discoveryReturns = "";
- serialPort.Write(crlf, 0, 2);
+ //serialPort.Write(crlf, 0, 2);
+ //serialPort.Write(crlf, 0, 2);
// serialPort.Write("....................");
- serialPort.Write("*450052.0#16,INFO");
- serialPort.Write(crlf, 0, 2);
+ //serialPort.Write("*BROADC.A#ST,QUIT");
+ //serialPort.Write("*BROADC.A#ST,DISCOVERY");
+
+ //serialPort.Write("*DISCOV.E#RY,DISCOVERY");
+ // serialPort.Write("*DISCOV.E#RY,DISCOVERY");
+ // serialPort.Write("*DISCOV.E#RY,DISCOVERY");
+ // serialPort.Write("*450052.0#16,INFO");
+// serialPort.Write(crlf, 0, 2);
//serialPort.Write("\r");
//Thread.Sleep(100);
//serialPort.Write("\n");
//Thread.Sleep(100);
- while (serialPort.BytesToRead <= 0) ;
- string infoReturns = serialPort.ReadExisting();
- dispatcher.enqueueEvent(new RealTimeEvents.NoteReceiver(this, "Read: " + infoReturns));
+ while (serialPort.BytesToRead <= 0)
+ {
+ serialPort.Write(crlf, 0, 2);
+ Thread.Sleep(100);
+ serialPort.Write("*BROADC.A#ST,QUIT");
+ serialPort.Write(crlf, 0, 2);
+ Thread.Sleep(100);
+ serialPort.Write("*BROADC.A#ST,DISCOVERY");
+ serialPort.Write(crlf, 0, 2);
+ Thread.Sleep(100);
+ serialPort.Write("*DISCOV.E#RY,DISCOVERY");
+ serialPort.Write(crlf, 0, 2);
+ Thread.Sleep(200);
+ }
+ while (serialPort.BytesToRead > 0)
+ {
+ discoveryReturns = serialPort.ReadExisting();
+ }
+
+ commandPreamble = crlf + discoveryReturns.Substring(0, 12) + ",";
+ dispatcher.enqueueEvent(new RealTimeEvents.NoteReceiver(this, "(receiver note) command preamble: " + discoveryReturns.Substring(0,12) + ","));
+ dispatcher.enqueueEvent(new RealTimeEvents.NoteReceiver(this, "(receiver note) read: " + discoveryReturns));
//string infoReturns = serialPort.ReadLine();
//if (infoReturns != "")
//{
@@ -152,14 +179,14 @@ public void shutdown()
{
var ret = string.Empty;
var buffer = new char[1]; // Not the most efficient...
- while (!ret.Contains(crlf_string))
+ while (!ret.Contains("\n") && (!ret.Contains("\r")))
{
var charsRead = await textReader.ReadAsync(buffer, 0, 1);
if (charsRead == 0)
{
throw new EndOfStreamException();
}
- ret += charsRead;
+ ret += buffer[0];
}
dispatcher.enqueueEvent(new RealTimeEvents.UnparsedMessage(this, ret));
}
View
BIN  SerialPortComponents/Receiver/bin/Release/Receiver.dll
Binary file not shown
View
BIN  SerialPortComponents/Receiver/bin/Release/Receiver.pdb
Binary file not shown
View
BIN  SerialPortComponents/Receiver/obj/Release/Receiver.dll
Binary file not shown
View
BIN  SerialPortComponents/Receiver/obj/Release/Receiver.pdb
Binary file not shown
View
6 SerialPortComponents/SerialPortSlice/SerialPortService.cs
@@ -98,7 +98,7 @@ private void serialPortsService()
}
//check for COM ports that have disappeared or have TTL = 0
- foreach (String r in receivers.Keys)
+ foreach (String r in receivers.Keys.ToList()) //error: collection was modified enumeration something or other
{
if (Array.IndexOf(SerialPort.GetPortNames(), r) == -1)
{
@@ -114,7 +114,7 @@ private void serialPortsService()
//if TTL = 0, it means that this port has been misbehaving consistently
//removing it now effectively restarts it during the next service loop
- foreach (Receiver r in receivers.Values)
+ foreach (Receiver r in receivers.Values.ToList())
{
if (r.TTL <= 0)
{
@@ -125,7 +125,7 @@ private void serialPortsService()
Thread.Sleep(serviceTime);
} while (serviceTime > 0);
- foreach (Receiver r in receivers.Values)
+ foreach (Receiver r in receivers.Values.ToList())
{
r.shutdown();
receivers.Remove(r.portName);
View
BIN  SerialPortComponents/SerialPortSlice/bin/Release/Receiver.dll
Binary file not shown
View
BIN  SerialPortComponents/SerialPortSlice/bin/Release/Receiver.pdb
Binary file not shown
View
BIN  SerialPortComponents/SerialPortSlice/bin/Release/SerialPortSlice.dll
Binary file not shown
View
BIN  SerialPortComponents/SerialPortSlice/bin/Release/SerialPortSlice.pdb
Binary file not shown
View
2  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.csproj.FileListAbsolute.txt
@@ -10,7 +10,7 @@
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\bin\Release\SerialPortSlice.dll
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\bin\Release\SerialPortSlice.pdb
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\bin\Release\Receiver.dll
-C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\bin\Release\Receiver.pdb
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\obj\Release\SerialPortSlice.csprojResolveAssemblyReference.cache
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\obj\Release\SerialPortSlice.dll
C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\obj\Release\SerialPortSlice.pdb
+C:\Users\Derek\cecs491\SerialPortComponents\SerialPortSlice\bin\Release\Receiver.pdb
View
BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.csprojResolveAssemblyReference.cache
Binary file not shown
View
BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.dll
Binary file not shown
View
BIN  SerialPortComponents/SerialPortSlice/obj/Release/SerialPortSlice.pdb
Binary file not shown
View
BIN  SerialPortComponents/ServerComponents.v11.suo
Binary file not shown
View
BIN  docs/diagrams/AddRemoveReceiverWithConfig.PNG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.