Exemplo n.º 1
0
            public static long saHpiSessionOpen(
                long DomainId,
                out long SessionId,
                Object SecurityParams
                )
            {
                long rv;
                bool rc;

                SessionId = 0;

                if (SecurityParams != null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                }

                HpiSession s = HpiCore.CreateSession(DomainId);

                if (s == null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_DOMAIN);
                }
                HpiMarshal m = s.GetMarshal();

                if (m == null)
                {
                    HpiCore.RemoveSession(s);
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }

                m.MarshalSaHpiDomainIdT(s.GetRemoteDid());
                rc = m.Interchange(OhpiConst.RPC_SAHPI_SESSION_OPEN);
                if (!rc)
                {
                    m.Close();
                    HpiCore.RemoveSession(s);
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    SessionId = m.DemarshalSaHpiSessionIdT();
                    s.SetRemoteSid(SessionId);
                    SessionId = s.GetLocalSid();
                }
                s.PutMarshal(m);
                if (rv != HpiConst.SA_OK)
                {
                    HpiCore.RemoveSession(s);
                }

                return(rv);
            }
Exemplo n.º 2
0
            public static long saHpiSessionClose(
                long SessionId
                )
            {
                long       rv;
                bool       rc;
                HpiSession s = HpiCore.GetSession(SessionId);

                if (s == null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_SESSION);
                }
                HpiMarshal m = s.GetMarshal();

                if (m == null)
                {
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                rc = m.Interchange(OhpiConst.RPC_SAHPI_SESSION_CLOSE);
                if (!rc)
                {
                    m.Close();
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    // No output arguments
                }
                s.PutMarshal(m);
                if (rv == HpiConst.SA_OK)
                {
                    HpiCore.RemoveSession(s);
                }

                return(rv);
            }
Exemplo n.º 3
0
            public static long saHpiDimiTestStart(
                long SessionId,
                long ResourceId,
                long DimiNum,
                long TestNum,
                long NumberOfParams,
                SaHpiDimiTestVariableParamsT[] ParamsList
                )
            {
                long rv;
                bool rc;

                if (NumberOfParams != 0)
                {
                    if (ParamsList == null)
                    {
                        return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                    }
                    if (NumberOfParams > ParamsList.Length)
                    {
                        return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                    }
                    for (int i = 0; i < NumberOfParams; ++i)
                    {
                        rc = HpiUtil.Check(ParamsList[i]);
                        if (!rc)
                        {
                            return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                        }
                    }
                }
                HpiSession s = HpiCore.GetSession(SessionId);

                if (s == null)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_SESSION);
                }
                HpiMarshal m = s.GetMarshal();

                if (m == null)
                {
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                m.MarshalSaHpiResourceIdT(ResourceId);
                m.MarshalSaHpiDimiNumT(DimiNum);
                m.MarshalSaHpiDimiTestNumT(TestNum);
                m.MarshalSaHpiUint8T(NumberOfParams);
                for (int i = 0; i < NumberOfParams; ++i)
                {
                    m.MarshalSaHpiDimiTestVariableParamsT(ParamsList[i]);
                }
                rc = m.Interchange(OhpiConst.RPC_SAHPI_DIMI_TEST_START);
                if (!rc)
                {
                    m.Close();
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    // No output arguments
                }
                s.PutMarshal(m);

                return(rv);
            }