We're building a few proof-of-concepts involving periodic or on-event data retrievals from PI. Immediately working with using event pipes, I see a possible problem regarding error handling and recovery (such as internal SDK errors, disconnected from server, error with polling etc).
To be clear: signing up for updates will only happen during initialization, so we don't have to worry about adding/removing more points for signup. _pipe.RemoveSignUp() is called upon termination (if _pipe!=null).
What are the recommended errors to trap for during initilization, the OnNewValue event and generally checking when the event pipe has failed? Can the event pipe be reinitialized or should all objects be made NULL and re-created.
Also, during the OnNewValue event, would it be beneficial to attempt the 'Using' block to assit with memory manayement? (For example, the code below uses the System.Array object. I could inherit it and attempt to implement the iDisposable interface and dispose the related objects) //EventPipes
Thanks in advance, below is a summary of the code in use:
PISDK.PISDK _sdk = new PISDK.PISDK();
PointList ptlist = new PointList();
//add points to pointlist
_pipe = (IEventPipe2)ptlist.Data.EventPipe;
_ptEvent = (_DEventPipeEvents_Event)_pipe;
_ptEvent.OnNewValue += new _DEventPipeEvents_OnNewValueEventHandler(_ptEvent_OnNewValue);
On new value Event handling
private void _ptEvent_OnNewValue()
Array tmpArray = _pipe.TakeAll();
foreach (Object obj in tmpArray)