예제 #1
0
        protected ReturnCode wlReq_SetListener(IListener aListener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Ok;

            Debug.Assert(listenerDispatcher != null);
            if (mask != 0 && aListener != null)
            {
                result = listenerDispatcher.Add(this, mask);
                if (result == DDS.ReturnCode.Ok)
                {
                    wait = true;
                }
            }
            else
            {
                V_RESULT uResult = User.Entity.SetListener(
                    rlReq_UserPeer, IntPtr.Zero, IntPtr.Zero, 0);
                result = uResultToReturnCode(uResult);
                if (result == DDS.ReturnCode.Ok)
                {
                    WaitListenerRemoved();
                    listenerDispatcher.Remove(this);
                }
            }

            if (result == DDS.ReturnCode.Ok)
            {
                listener     = aListener;
                listenerMask = mask;
            }

            return(result);
        }
예제 #2
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_topicMatchInfo from = (v_topicMatchInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle         = GCHandle.FromIntPtr(toPtr);
            PublicationMatchedStatus to = toGCHandle.Target as PublicationMatchedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #3
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_livelinessChangedInfo from = (v_livelinessChangedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle        = GCHandle.FromIntPtr(toPtr);
            LivelinessChangedStatus to = toGCHandle.Target as LivelinessChangedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #4
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_inconsistentTopicInfo from = (v_inconsistentTopicInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle        = GCHandle.FromIntPtr(toPtr);
            InconsistentTopicStatus to = toGCHandle.Target as InconsistentTopicStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #5
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_incompatibleQosInfo from = (v_incompatibleQosInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle             = GCHandle.FromIntPtr(toPtr);
            OfferedIncompatibleQosStatus to = toGCHandle.Target as OfferedIncompatibleQosStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #6
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_sampleLostInfo from = (v_sampleLostInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle         toGCHandle = GCHandle.FromIntPtr(toPtr);
            SampleLostStatus to         = toGCHandle.Target as SampleLostStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #7
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_deadlineMissedInfo from = (v_deadlineMissedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            RequestedDeadlineMissedStatus to = toGCHandle.Target as RequestedDeadlineMissedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #8
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_readerStatus from = (v_readerStatus)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);

            DDS.OpenSplice.Common.ReaderStatus to = toGCHandle.Target as DDS.OpenSplice.Common.ReaderStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
예제 #9
0
        internal static V_RESULT CopyOut(ref v_handle_s from, ref InstanceHandle to)
        {
            IntPtr   instance;
            V_RESULT result = V_RESULT.INTERNAL_ERROR;

            if (from.server == IntPtr.Zero && from.index == 0 && from.serial == 0)
            {
                to     = 0;
                result = V_RESULT.OK;
            }
            else
            {
                if (v_handle.Claim(from, out instance) == v_handleResult.V_HANDLE_OK)
                {
                    to = User.InstanceHandle.New(instance);
                    if (v_handle.Release(from) == v_handleResult.V_HANDLE_OK)
                    {
                        result = V_RESULT.OK;
                    }
                }
            }

            return(result);
        }
예제 #10
0
        /// <summary>
        /// This operation allows an application thread to wait for the occurrence of at least one
        /// of the conditions that is attached to the WaitSet.
        /// </summary>
        /// <param name="activeConditions">a sequence which is used to pass the list of all the attached
        /// conditions that have a trigger_value of true.</param>
        /// <param name="timeout">the maximum duration to block for the wait, after which the application thread
        /// is unblocked. The special constant Infinite can be used when the maximum waiting time does not
        /// need to be bounded.</param>
        /// <returns>Possible return codes for the operation are:
        /// Ok, Error, OutOfResources, Timeout or PreconditionNotMet</returns>
        public ReturnCode Wait(ref ICondition[] activeConditions, Duration timeout)
        {
            ReturnCode result = DDS.ReturnCode.Ok;

            ReportStack.Start();
            WaitActionArg arg = new WaitActionArg(activeConditions);

            if (QosManager.countErrors(timeout) > 0)
            {
                result = DDS.ReturnCode.BadParameter;
                ReportStack.Report(result, "Duration timeout incorrect");
            }

            while (result == DDS.ReturnCode.Ok && arg.nrTriggeredConditions == 0)
            {
                lock (this)
                {
                    arg.maxConditions  = conditionList.Count + guardList.Count;
                    arg.attachedGuards = guardList.ToArray();
                    if (activeConditions == null)
                    {
                        activeConditions = new ICondition[arg.maxConditions];
                    }
                }

                GCHandle argGCHandle = GCHandle.Alloc(arg, GCHandleType.Normal);

                V_RESULT uResult = DDS.OpenSplice.User.WaitSet.WaitAction2(
                    rlReq_UserPeer,
                    WaitAction,
                    GCHandle.ToIntPtr(argGCHandle),
                    timeout.OsDuration);

                if (uResult == V_RESULT.DETACHING)
                {
                    arg = (WaitActionArg)argGCHandle.Target;
                    lock (this)
                    {
                        foreach (ICondition cond in conditionList)
                        {
                            Condition condImpl = cond as Condition;
                            if (condImpl.IsAlive() == DDS.ReturnCode.AlreadyDeleted)
                            {
                                arg.Add(cond);
                            }
                        }
                    }
                    result = DDS.ReturnCode.Ok;
                }
                else
                {
                    result = SacsSuperClass.uResultToReturnCode(uResult);
                    arg    = (WaitActionArg)argGCHandle.Target;
                }

                argGCHandle.Free();

                activeConditions = arg.Finalize();
            }
            ReportStack.Flush(this, (result != ReturnCode.Ok) && (result != ReturnCode.Timeout));

            return(result);
        }
예제 #11
0
        internal static DDS.ReturnCode uResultToReturnCode(V_RESULT uResult)
        {
            DDS.ReturnCode result;

            switch (uResult)
            {
            case V_RESULT.OK:
                result = DDS.ReturnCode.Ok;
                break;

            case V_RESULT.OUT_OF_MEMORY:
                result = DDS.ReturnCode.OutOfResources;
                break;

            case V_RESULT.ILL_PARAM:
                result = DDS.ReturnCode.BadParameter;
                break;

            case V_RESULT.CLASS_MISMATCH:
                result = DDS.ReturnCode.PreconditionNotMet;
                break;

            case V_RESULT.DETACHING:
                result = DDS.ReturnCode.AlreadyDeleted;
                break;

            case V_RESULT.TIMEOUT:
                result = DDS.ReturnCode.Timeout;
                break;

            case V_RESULT.OUT_OF_RESOURCES:
                result = DDS.ReturnCode.OutOfResources;
                break;

            case V_RESULT.INCONSISTENT_QOS:
                result = DDS.ReturnCode.InconsistentPolicy;
                break;

            case V_RESULT.IMMUTABLE_POLICY:
                result = DDS.ReturnCode.ImmutablePolicy;
                break;

            case V_RESULT.PRECONDITION_NOT_MET:
                result = DDS.ReturnCode.PreconditionNotMet;
                break;

            case V_RESULT.ALREADY_DELETED:
                result = DDS.ReturnCode.AlreadyDeleted;
                break;

            case V_RESULT.HANDLE_EXPIRED:
                result = DDS.ReturnCode.BadParameter;
                break;

            case V_RESULT.UNSUPPORTED:
                result = DDS.ReturnCode.Unsupported;
                break;

            case V_RESULT.NO_DATA:
                result = DDS.ReturnCode.NoData;
                break;

            case V_RESULT.NOT_ENABLED:
                result = DDS.ReturnCode.NotEnabled;
                break;

            case V_RESULT.UNDEFINED:
            case V_RESULT.INTERRUPTED:
            case V_RESULT.INTERNAL_ERROR:
            default:
                result = DDS.ReturnCode.Error;
                break;
            }
            return(result);
        }