Thank you for your help. Really appreciated... I will have a look at this approach and implement it. Thanks again!!!
faheemnadeem
Posts
-
Implementing a list of abstract objects... -
Implementing a list of abstract objects...I think so its better if i give u the class implementations. a quick look will clarify u everything... What i intend to do in a bigger picture is implement a experiment which uses two kinds of hardware an oscilloscope and an encryption board. i intend to measure power waves from the fpga board when an encryption is being done, collect its waveform and store it some where. this single step is called collecting a trace. i intend to do it almost a million times in a fast manner. and record a million waveforms acquired from oscilloscope somewhere. The have made wrappers for the original oscilloscope driver written in c++ so they are compatible with c#. the drivers are all written, they specify to IVI standard and all the methods are implemented in a form of a class. The class hierarchy i intend to implement for the experiment is: IOscilloscope <---- Oscilloscope <----- Visa Oscilloscope <------ (TkTDS1012B , DSO1024) The last classes e.g. tktds1012B connects to a driver class (e.g. tk1k2kDriver and connects to required methods it requires to get data from oscilloscope. I am providing the links to these classes: http://www.mediafire.com/?p3hzzcn2o45qucv Kindly if u have some time, then have a look at it... I just want a way to implement the properties for channel class they way i implement visaoscilloscope properties in inherited classes... Thank you for your help thus far...
-
Implementing a list of abstract objects...Yes you are right again... What i have done till now is initialize the channel list in the utility class inheriting from visaoscilloscope. While implementing the 'init' method i populate the list with channels and their respective properties by connecting to the respective oscilloscope driver and getting real-time value of that property for that particular channel and correspondingly update the list. This only happens once i call the init method the first time. The problem which i am trying to figure out is they way i have implemented the base oscilloscope properties is that they are connected to the driver itself in the gettter setters, so they give me the current realtime value of the oscilloscope attribute when they are called from let say my GUI class. e.g. if i ask a visaoscilloscope for its ID. which is a general property has to be implemented by each oscilloscope. So i do from my gui class. assume this scope object points to a particular utility/driver/scope
visaoscilloscope myscope = new visaoscilloscope();
string ID = myscope.ID;the id field which is abstract in visaoscilloscope is implemented in the inherited utility class (because there are different ways of getting an ID for each driver and i have to connect a driver class to it also) so in the ID implementation, i just do this.
public override string ID
{
get { return myTk.GetString(tktds1k2kProperties.IdQueryResponse); }
}Therefore it always gives me real-time response from oscilloscope. What i want is also realtime response for my channel properties. if i implement the current scenario u suggested the fields are only updated once i call the init method. which have to be called only once during the initialization phase. If you understood my point i would be really thankful to hear a solution... if u want i can send u the classes... i know it is a simple enough problem. but this is something i have never tried and i am particularly new to this... Really thankful for the help u have given my thus far...
-
Implementing a list of abstract objects...hi, thanks for the reply... The problem is i need to implement the properties related to the channels in the inherited utility class. e.g. if i try your approach... which i already did... i made another abstract class and moved all the channel related properties to that class. e.g.
public abstract class Channel
{
[Category("IviScopeBase Capability Group")]
[DefaultValueAttribute(false)]
[DescriptionAttribute("If set to True, the oscilloscope acquires a waveform for the channel. If set to False, the oscilloscope does not acquire a waveform for the channel")]
public abstract bool ChannelEnabled { get; set; }\[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(false)\] \[DescriptionAttribute("Specifies whether channel is inverted or not")\] public abstract bool ChannelInverted { get; set; } \[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Returns the physical repeated capability identifier defined by the specific driver for the channel that corresponds to the one-based index that the user specifies. If the driver defines a qualified channel name, this property returns the qualified name")\] public abstract double ChannelName { get; } \[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Specifies the input impedance for the channel in Ohms. Common values are 50.0, 75.0, and 1,000,000.0")\] public abstract double InputImpedance { get; set; } \[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Specifies the maximum frequency for the input signal you want the instrument to accommodate without attenuating it by more than 3dB")\] public abstract double MaximumInputFrequency { get; set; } \[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Specifies the scaling factor by which the probe the end-user attaches to the channel attenuates the input. For example, for a 10:1 probe, the end-user sets this attribute to 10.0")\] public abstract double ProbeAttenuation { get; set; } \[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Specifies how the oscilloscope couples the input signal for the channel")\] public abstract VerticalCou
-
Implementing a list of abstract objects...Hi. I have a problem which i am stuck in badly. Scenario: I have a abstract class named "VisaOscilloscope" defining some abstract methods and properties, which some driver utility classes inherit and implement the actual external hardware driver functionality.e.g. i am giving a shorter version of the class below.
public abstract class VisaOscilloscope : Oscilloscope
{
[Category("IviScopeBase Capability Group")]
[DefaultValueAttribute(0)]
[DescriptionAttribute("Specifies the location of the center of the range that the Vertical Range attribute specifies. The value is with respect to ground and is in volts")]
public abstract double VerticalOffset { get; set; }\[Category("IviScopeBase Capability Group")\] \[DefaultValueAttribute(0)\] \[DescriptionAttribute("Specifies the absolute value of the full-scale input range for a channel. The units are volts")\] public abstract double VerticalRange { get; set; } \[Category("IviScopeProbeAutoSense Extension Group")\] \[DefaultValueAttribute(false)\] \[DescriptionAttribute("If this attribute is True, the driver configures the oscilloscope to sense the attenuation of the probe automatically. If this attribute is False, the driver disables the automatic probe sense and configures the oscilloscope to use the value of the Probe Attenuation attribute")\] public abstract bool ProbeAttenuationAuto { get; set; } public abstract void init(); public abstract void activate(); public abstract void acquire(); public abstract float\[\] collect(); public abstract void close();
Now a utility class that has to inherit from this base class and implement the properties and methods by connecting to a pre-written driver. e.g.
class TK\_TDS1012B : VisaOscilloscope {
public override double VerticalOffset
{
get
{
return myTk.GetDouble(tktds1k2kProperties.VerticalOffset);
}
set
{
throw new NotImplementedException();
}
}public override double VerticalRange { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public override bool ProbeAttenuationAuto
-
Selecting between base class and interface method...Can you please give me a small sample implementation based on the structure given above... as i have no clue about proxy classes. I would be really thankful. :)
-
Selecting between base class and interface method...Ok the i am getting an error on...
public boolean getState() { return doLamp.getState(); }
And the error is... "The return type is incompatible with Service.getState()". Now if i change the implementation to
public boolean ILamp.getState() { return doLamp.getState(); }
No i am not allowed to do this again gives an error "Return type for the method is missing". if i read rightly in forum message u provided that the explicit implementations are allowed in C# and not in JAVA. P.s. i am reading a book on java but this is new for me and i can't understand so some help would be really grateful.
-
Selecting between base class and interface method...Getting an error while implementing the last method "getState"...
-
Selecting between base class and interface method...Thanks for the reference link... But still i am unable to grasp the solution being a novice programmer. Should i make another interface that links to my "ILamp" interface. And then implement the new one in my worldlamp class. Ok for a little help here is my current current class structure:
package mw;
import org.mundo.bas.DoILamp;
import org.mundo.bas.ILamp;
import org.mundo.rt.Service;
import org.mundo.rt.Session;
import org.mundo.rt.Signal;public class worldlamp extends Service implements ILamp {
// Private member variables private String CHANNEL\_NAME = ""; private static final String ZONE\_NAME = "lan"; private DoILamp doLamp; /\* \* Default Constructor \*/ public worldlamp(String ch) { CHANNEL\_NAME = ch; } /\* \* Fired on service initialized \* @see org.mundo.rt.Service#init() \*/ public void init() { try { // Subscribe to channel Signal.connect( getSession().subscribe(ZONE\_NAME, CHANNEL\_NAME), this); // Initialize stub doLamp = new DoILamp(); // connect stub for publishing Signal.connect(doLamp, getSession().publish(ZONE\_NAME, CHANNEL\_NAME)); } catch (Exception x) { x.printStackTrace(); } } @Override public void setState(boolean b) { doLamp.setState(b); } @Override public boolean getState() { return doLamp.getState(); }
}
And the ILamp Interface
package org.mundo.bas;
import org.mundo.rt.ActiveArray;
import org.mundo.rt.ActiveMap;//@mcRemote(className="org.mundo.bas.ILamp")
public interface ILamp
{
public void setState(boolean b);
public boolean getState();
}I don't have the source for "Service". Its a Jar library. And i can't change the ILamp interface too... It is generated from a script... so has to stay the same... Kindly can you please give me a solution to this...
-
Selecting between base class and interface method...Hi, I have a class "worldstore" that is derived from "Service" class and implements interface "ILamp". I have a method called "getState" in ILamp interface which returns a "boolean" and another method is available with the same name in "Service" base class which returns an "int". While implementing the methods of the interface in "worldstore" class, I get an error when implementing "getState" from ILamp. Whereby, eclipse detects it to belonging to the base "Service" class rather than that of the ILamp interface, and therefore asks me to change the return type to boolean. All i want is to implement the "getState" method from the interface. Any solutions please... I am using java 1.6 Thanks.
-
Adding command line arguments to batch file produced from Ant build scriptHi, I have an ant build script as shown below.
<target name="runscript" depends="compile">
<echo file="run.sh" append="false">java -cp ${mclib}/mundocore.jar:bin Chat</echo>
<chmod file="run.sh" perm="+x"/>
<echo file="run.bat" append="false">java -cp ${mclib}/mundocore.jar;bin Chat</echo>
</target>The build script portion produces a batch file named run.bat, which simply executes a java compiler command.
java -cp C:\mundocore-1.0.0-RC1\lib\se/mundocore.jar;bin Chat
I want to send some commandline arguments with the run.bat script.e.g in command prompt
run.bat hello
How can i change the the ant build script to generate a batch file that can accept arbitrary number of command line arguments. Thanks in advance...
-
Help regarding compiling a libraryHi, I am trying to install "Givaro" arithmetic library for VC++.net 2008. http://ljk.imag.fr/CASYS/LOGICIELS/givaro/[^] Installation Instructions: http://ljk.imag.fr/CASYS/LOGICIELS/givaro/givaro_install.html[^] I already compiled "GMP" using "MPIR" and it is working as expected. http://www.exploringbinary.com/how-to-install-and-run-gmp-on-windows-using-mpir/[^] The problem is i am new to C++ and also i am on windows :( I tried to use VS "NMAKE" tool to compile the MAKEFile but it doesn't seem to be working as well. Kindly can someone help me compile this library with any other tool in windows. :) Thanks in advance.. Regards, Faheem Nadeem
-
LINQ to xml queryHi, I am trying to delete some nodes from an xml document. I am using LINQ to xml and want to stick to this approach. Here is my XML document:
I have to perform two cases. 1. Delete clip node based on ID. 2. Clear whole project root tag. I am using the following code to delete nodes.
// Obtain the first clip entry
IEnumerable<XElement> clip = (from c in this.oProjectDoc.Element("Project").Element("Clips").Elements("Clip")
where c.Attribute("ID").Value.Equals(ID)
select c);// Delete clip entry foreach (XElement xe in clip) xe.Remove(); // Save updated options document to file system this.oProjectDoc.Save(this.oProjectPath.FullName);
Have tried this
-
Live GPS data and Video synchronized recording and playbackIf i am guessing right then your question was how i can associate multiple GPX files to a video or single GPX files to multiple videos. The solution is simple. I was using the name of the files to identify them. e.g i was using a label like this: Both video and gpx files are in the same directory and have the same label for the same job. As the recording for both was started at the same time, so time + date stamp is unique, you can always use a unique ID in front to identify as well. i used the IMEI to identify individual remote clients internally and the part no to identify the number of GPX files or video files associated with each other. Usually i used a single GPX file to record data as while recording i forced the OS file stream buffer to write the stream to text file immediately once arrived so that data won't be lost or the GPX text file corrupted in case of power loss. Usually you have to make multiple clips of the recorded videos to avoid much data loss incase of power loss. I used to make a new clip after 10 minutes. I hope i got your question right. Get back to me if there is anything else you require Bye.
-
Live GPS data and Video synchronized recording and playbackHi, Sorry i am a bit late replying to your question. Anyways there were many ways to implement the syncing of GPS data with a video file. I completed my project sometime ago. In my case i had to implement a very precise synchronization because I had an airborne stabilized articulated camera which has to lock on a certain location and the data was simultaneously play backed with the video and it was very easy to spot sync discrepancies. Solutions: 1. In real-time while recording one can take the time-stamp from the video when GPS data arrived, store it in a hash-table and while playing it back just search for the closest time stamp from the hash-table matching with current video time after some fixed interval (200ms). This method introduced some time delay as the data display event is to be fired after fixed time interval. (Works well nonetheless). 2. See the basic algorithm to sync subtitle (.srt) files on video. It can be used as well with some modifications. 3. In my case i had to be able to playback recording in a video only, Video + Data and Data only modes with varying playback speeds. No problem for video only mode. For data only mode I used two timers. At start or zero time I read the first NMEA string from the recorded text file. Note: Time stamps are attached with each NMEA string like in .srt file (a unique time not a range). i also read the the second string time and saved a copy of it. Parsed and displayed the first NMEA strings data, took the difference of two time stamps and set the second timer to fire at the next time interval which took the second line and did the same things and sets the first timer as in the previous case. Thus providing synchronization's with minimal delay. Playing it varying speeds is also easy as you have to just divide or multiply the timer value with playback speed. Same procedure follows with video and NMEA data synchronization. The last case is difficult to implement if you are using a seek bar as well but provides the best synchronization with least processing. I hope you got some clue to the solution. Bye...
-
Case for .net remotingHi, i have a windows service having a udp server, tcp server and a serial server all acquiring GPS data from remote devices. After data is acquired it is parsed for validity and processed into defined objects. Now this data has to be relayed to multiple client UI's which can be running on a local or a remote machine. Previously i used MSMQ for data sharing between different processes but i seem to be having some problem with connecting to remote machines. So i decided to switch to .net remoting. Its my first take on remoting so kindly bare with me. I have to share that real-time parsed objects with multiple clients with minimum latency. The channel between server and client should allow 2-way communication between client and server in the form of a string and objects. I wish to inquire which type of object activation should i use. Thanks in advance.
-
Unattended Installation of MSMQ in Windows 7 and XPHi, I wish to create an unattended automated installation for MSMQ component with no http support for both of the mentioned OS. As i have never done this before, kindly if anyone can help, i will be most thankful.
-
Live GPS data and Video synchronized recording and playbackhi thankyou for ure deep insight. but i must define my problems a bit more. customized gps data coming from a remote data is not to be overlaid on thr video stream rather on maps and several gauges providing also virtual fieldview from above. data is cming around at 3-4hz not at fixed time intervals as its ota. i donot need perfect synchronization just efficent logging and playback techniques to take toll from cpu. as user front end manages multiple live connections each with video feeds maps gauges blah blah and sinultaneously i wish to ablle to playback multiple logged data. so just need some kind of cpu efficent algorithm to playback data and video feed simultaneously or independently and a pattern to log data. thanks in advance.
-
Live GPS data and Video synchronized recording and playbackHi, I have Live GPS data streaming over a serial port and live video feed on a capture device. Both are related in time. I wish to log (in a text file) incoming GPS data (whether valid or not) synchronized with live video feed recording. And then be able to playback both of them, same thing as in movie subtitles. Need some help how on: 1 - What pattern to adopt while logging data with the live video recording file in a text file. 2 - Pattern on how to playback the logged data and video file in a synchronized manner. Least amount of CPU resources are to be used as i intend to run multiple playback simultaneously. Thank you in advance...
-
Triggering an event from another class?Thank you guys. Did some snopping around and found no other way than you guys mentioned. Thank you...