Hi Chris,
Good news I reproduced the bug on my side
(and in the mean time fixed a bug with the C# channel access server as well)
and I think I fixed the bug too. The latest version can be found on
sourceforge.
For more details about this issue, somehow
I didn't handled the arrays correctly and wasn't looking for the base type requested
by the user of the library.
In case something doesn't work, let me
know and I shall try to help you.
Sincerely,
Alain Bertrand
From: Christopher J. Pendleton [mailto:[email protected]]
Sent: Saturday, November 23, 2013
07:37
To: Bertrand
Alain Gregor
Subject: RE: Rejected email
Hi Alain.
I apologize for the
rejection. I have added psi.ch to our whitelist so I don’t think this
will happen again. Please reply to make sure.
Thanks for the
response on the C# issue. I will try double[] this weekend.
Regards,
Chris
Hi,
My mail have been rejected by your system. Sure thing it wasn't a spam:
---------------------------
Hi Christopher,
You should be able to work with floats indeed. However it could be that I
didn't tested it correctly. I will do some trials next week and let you know.
In the mean time, can you please try to grab it as double[] instead of float[]
and see if it works?
Sincerely,
Alain Bertrand
On 11/22/2013 4:10 PM, Christopher J. Pendleton wrote:
Hello.
Let me start by saying that I started using EPICS to interface to our
company's devices (http://ptcusa.com/) earlier
this year and it has been a
pleasure to work with. You guys are doing great work and I hope I can
contribute to the cause.
One of my colleagues is a big fan of C#, so I pointed him to the EpicsSharp
library. I started using it to help him sort through some issues he was
having. The major one I am seeing is with float arrays (arrays in general?)
while using the MonitorChanged event.
Details:
I have a channel access server running, serving up a float array PV. Both
Python (PyEpics) and LabVIEW (CA Lab) client interfaces see this PV and
recognize it as a float array. No problems here. When I use EpicsSharp, I
can get the float array by using the synchronous call Get<float[]>() on
the
channel object. Also no problems here. I see unexpected behavior when I use
the MonitorChanged event. My code:
///
static class Program
{
[STAThread]
static void Main()
{
EpicsClient client = new EpicsClient();
EpicsChannel<float[]> record =
client.CreateChannel<float[]>("r_I128_channels_test");
record.MonitorChanged += new
EpicsDelegate<float[]>(record_MonitorChanged);
Console.ReadKey();
}
static void
record_MonitorChanged(EpicsChannel<float[]> sender,
float[] newValue)
{
Console.WriteLine("Help!");
}
}
///
I would expect to see an event fire into my handler, but I don't. What I do
see is an exception in my console window:
///
System.Collections.Generic.KeyNotFoundException: The given key was not
present i
n the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey
key)
at
PSI.EpicsClient2.EpicsChannel`1.<Disconnect>b__3(EpicsChannel action)
in D
:\Projects\epicsC#\client\EpicsGenericChannel.cs:line 99
///
I dug into the client library code and found that the exception was
happening in EpicsGenericChannel.cs, line 99.
//
p.DataType = (ushort) TypeHandling.Lookup[typeof (TType)];
//
typeof (TType) evaluates to Single[], which isn't in TypeHandling
Dictionary, so an exception is thrown.
Do you expect this behavior? Is there a problem in my client program code? I
found another example on techtalk by Alain Bertrand
(http://www.aps.anl.gov/epics/tech-talk/2011/msg01584.php)
that shows almost
the same code with an int[], so I am a little lost. Thanks in advance for
your help!
Regards,
Chris
Christopher J. Pendleton
Director, Software Development
Pyramid Technical Consultants, Inc.
Office: +1 781-402-1700 x114
Cell: +1 781-249-3031