Esempio 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);
                }
                OhpiMarshal 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);
            }
Esempio n. 2
0
            public static long oHpiHandlerCreate(
                long SessionId,
                oHpiHandlerConfigT HandlerConfig,
                out long HandlerId
                )
            {
                long rv;
                bool rc;

                HandlerId = HpiConst.SAHPI_LAST_ENTRY;

                rc = OhpiUtil.Check(HandlerConfig);
                if (!rc)
                {
                    return(HpiConst.SA_ERR_HPI_INVALID_PARAMS);
                }

                HpiSession s = HpiCore.GetSession(SessionId);

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

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

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                m.MarshaloHpiHandlerConfigT(HandlerConfig);
                rc = m.Interchange(OhpiConst.RPC_OHPI_HANDLER_CREATE);
                if (!rc)
                {
                    m.Close();
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    HandlerId = m.DemarshaloHpiHandlerIdT();
                }
                s.PutMarshal(m);

                return(rv);
            }
Esempio n. 3
0
            public static long oHpiHandlerInfo(
                long SessionId,
                long HandlerId,
                out oHpiHandlerInfoT HandlerInfo,
                out oHpiHandlerConfigT HandlerConfig
                )
            {
                long rv;
                bool rc;

                HandlerInfo   = null;
                HandlerConfig = null;

                HpiSession s = HpiCore.GetSession(SessionId);

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

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

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                m.MarshaloHpiHandlerIdT(HandlerId);
                rc = m.Interchange(OhpiConst.RPC_OHPI_HANDLER_INFO);
                if (!rc)
                {
                    m.Close();
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    HandlerInfo   = m.DemarshaloHpiHandlerInfoT();
                    HandlerConfig = m.DemarshaloHpiHandlerConfigT();
                }
                s.PutMarshal(m);

                return(rv);
            }
Esempio n. 4
0
            public static long oHpiHandlerFind(
                long SessionId,
                long ResourceId,
                out long HandlerId
                )
            {
                long rv;
                bool rc;

                HandlerId = HpiConst.SAHPI_LAST_ENTRY;

                HpiSession s = HpiCore.GetSession(SessionId);

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

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

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                m.MarshalSaHpiResourceIdT(ResourceId);
                rc = m.Interchange(OhpiConst.RPC_OHPI_HANDLER_FIND);
                if (!rc)
                {
                    m.Close();
                    return(HpiConst.SA_ERR_HPI_NO_RESPONSE);
                }
                rv = m.DemarshalSaErrorT();
                if (rv == HpiConst.SA_OK)
                {
                    HandlerId = m.DemarshaloHpiHandlerIdT();
                }
                s.PutMarshal(m);

                return(rv);
            }
Esempio n. 5
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);
                }
                OhpiMarshal 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);
            }
Esempio n. 6
0
            public static long oHpiHandlerRetry(
                long SessionId,
                long HandlerId
                )
            {
                long rv;
                bool rc;

                HpiSession s = HpiCore.GetSession(SessionId);

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

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

                m.MarshalSaHpiSessionIdT(s.GetRemoteSid());
                m.MarshaloHpiHandlerIdT(HandlerId);
                rc = m.Interchange(OhpiConst.RPC_OHPI_HANDLER_RETRY);
                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);
            }
Esempio n. 7
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);
                }
                OhpiMarshal 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);
            }