Re: need data capture, stat analysis, graph display software for PC
- From: "John Barrett" <ke5crp1@xxxxxxxxxxx>
- Date: Fri, 23 Mar 2007 20:25:58 GMT
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:dyVMh.17081$2F5.9747@xxxxxxxxxxxxxxxxxxxxxxx
"John Barrett" <ke5crp1@xxxxxxxxxxx> wrote in message
news:rdUMh.100$un.40@xxxxxxxxxxx
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:ZbHMh.8121$Kk5.859@xxxxxxxxxxxxxxxxxxxxxxx
"John Barrett" <ke5crp1@xxxxxxxxxxx> wrote in message
news:SoFMh.10724$8B1.2161@xxxxxxxxxxx
"colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx> wrote in message
news:gNEMh.17020$2F5.756@xxxxxxxxxxxxxxxxxxxxxxx
....
I was thinking more realtime than logging to files -- think about
having the com thread pump the data to a writer thread in that case :)
sounds like you may end up with 3 or 4 threads sharing the load, which
is a good thing IMO -- as threads that are idle dont take resources --
event driven makes life much simpler
might also look at the background worker class -- it encapsulates a lot
of the crap for starting a worker thread as needed and getting notified
when it completes
I dragged that very class right of the IDE toolbar into the project.
same with the serial class.
3 or 4 threads is probably about right.
I need to save the data regardless anyway.
I could have the analysis done after all the data is gathered but realy
would like to see how well its progressing so i can catch anything
going wrong and not waste days colecting duff data.
I found a Queue wich can transfer objects between threads
took me a while to figure out I needed to actualy create an instance of
it with new.
works but I gues I need to protect it with lock and I need to have
something to wait on.
I tried the messaging thing but it complains its not installed on my pc.
the sockets seem primitive as they stil rely on byte streams,
although come to think of it that is actually all what I have anyway.
cant beleive they havnt put in some sort of decent inter thread message
queue.
although theres a few examples of how to implemet one about.
cant even send them as simple windows event messages like with mfc.
Colin =^.^=
ya -- they dont make the collection classes thread-safe for performance
reasons -- they figure anyone that needs it thread safe can create a
wrapper class derived from the collection and override the key methods to
implement locking
If by messaging, you are talking about MSMQ -- thats a bit overkill for
this --
ah ok I guesed it was something a bit more complicated.
just create a protected queue class and go from there --
done that.
its easy enough to add events to the class so that the reciever can get
notification when data is available. You dont need to "wait" on
anything -- just have each class set up its event handlers in the
constructor, and leave the instance to sit until an event occurs.
erm easy if you know how I gues, I didnt come accross events so far,
im using the workerthread things dragged from the toolbox so I kind
bypased the constructor details.
I used System.Threading.AutoResetEvent, to wait for the queue to become
non empty,
wich is actually easy enough.
"simple windows event messages" -- why get the OS involved with the
notifications ?? I can understand how you would feel that WM is simple
given your MFC background, but you are pushing your message out of
process when it really doesnt need to. using WM like that was a "lazy"
solution for people that didnt want to write thread safe code, or didnt
undestand mutual exclusion locks and syncronization. Not that I didnt use
it when I was writing win apps in C++, but it really wasnt the right way
to solve the problem :)
but it sounds like these event handlers you mention before do the
equivalent of
what the old win32 messages do wich is what I was looking for,
but just with the strong type control thats needed ?
windows messages wasnt realy a lazy solution as they were the underlying
fabric of mfc.
they were not only used to talk from task to task but mostly within the
same task.
although there was the problem of ensuring what was responsible for the
allocated memory
wich c# takes care of.
I find it hard to beleive the functionality of sscanf isnt in c#
I found loads of articles of people trying to convert c++ code into c#
and loads of people trying to answer but getting tied into knots with
saying you just use
regex or tryparse without realy knowing how to exactly,
but these are either rather low level or overkill.
trying to parse my variables wich are seperated with a variety of
delimiters for clarity
is irritating without an equivalent.
I tried to make a function template but it wouldnt let me access the right
TryPars member from the template. So i have one for each type. it works
anyway.
thanks
Colin =^.^=
To create an event
1. create a "public delegate <method prototype>;" outside the class that
will have the event... inside the class -- add a "public event <delegate
method name> <event name>;"
2. any place in the class where you want to fire the event, add "if (<event
name> != null) <event name>(delegate params);"
3. in any class that you want to handle the event, add "object.<event name>
+= handler;"... the IDE will create the handler stub for you if you hit tab
twice after the +=
the delegate defines the parameters that will be passed, the event statement
defines the variable that will contain the list of handlers to be invoked
when the event is fired. Since delegates are typed, you can pass any
number/type of parameters that you like -- no limitations :)
Re sccanf == ya -- that doesnt really fit into the java/c# paradigm --
you've probably already found this or something similar -- but here is a
regex based sccanf for c#
http://www.codeproject.com/csharp/CsScanf.asp
.
- Follow-Ups:
- References:
- need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: Wim Ton
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- Re: need data capture, stat analysis, graph display software for PC
- From: John Barrett
- Re: need data capture, stat analysis, graph display software for PC
- From: colin
- need data capture, stat analysis, graph display software for PC
- Prev by Date: EMI testing with 10 V/M immunity
- Next by Date: Polaroid PolaPulse Battery
- Previous by thread: Re: need data capture, stat analysis, graph display software for PC
- Next by thread: Re: need data capture, stat analysis, graph display software for PC
- Index(es):
Relevant Pages
|