Beispiel #1
0
 public virtual int GetTemperatureFromSMARTData(SmartInfo smartInfo)
 {
     foreach (SmartAttribute smartAttribute in smartInfo.attributes)
     {
         if (smartAttribute.id == 194)
         {
             return((int)smartAttribute.raw[0]);
         }
     }
     return(-1);
 }
Beispiel #2
0
        public override StorApiStatus GetSmart(ref SmartInfo smart)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;
            byte          b             = 0;

            MvApi.MvApi.SMART_Info_Request smart_Info_Request = default(MvApi.MvApi.SMART_Info_Request);
            smart_Info_Request.header.Init();
            smart_Info_Request.header.requestType       = 1;
            smart_Info_Request.header.startingIndexOrId = 0;
            smart_Info_Request.header.numRequested      = 30;
            lock (MarvellUtil.mvApiLock)
            {
                try
                {
                    b = MvApi.MvApi.MV_PD_GET_SMART_INFO(((MarvellController)this.controller).AdapterId, this.mvid, ref smart_Info_Request);
                }
                catch (Exception ex)
                {
                    Logger.Warn("MV_PD_GET_SMART_INFO exception: {0}", new object[]
                    {
                        ex
                    });
                    return(StorApiStatusEnum.STOR_API_ERROR);
                }
            }
            if (b == 0)
            {
                if (smart == null)
                {
                    smart = new SmartInfo();
                }
                smart.attributes = new SmartAttribute[(int)smart_Info_Request.header.numReturned];
                smart.thresholds = new SmartThreshold[(int)smart_Info_Request.header.numReturned];
                for (short num = 0; num < smart_Info_Request.header.numReturned; num += 1)
                {
                    SmartAttribute smartAttribute = new SmartAttribute();
                    SmartThreshold smartThreshold = new SmartThreshold();
                    smartAttribute.id      = smart_Info_Request.SmartInfo[(int)num].Id;
                    smartAttribute.flags   = (ushort)((int)smart_Info_Request.SmartInfo[(int)num].StatusFlags1 << 8 | (int)smart_Info_Request.SmartInfo[(int)num].StatusFlags2);
                    smartAttribute.current = smart_Info_Request.SmartInfo[(int)num].CurrentValue;
                    smartAttribute.worst   = smart_Info_Request.SmartInfo[(int)num].WorstValue;
                    Array.Copy(smart_Info_Request.SmartInfo[(int)num].RawValue, smartAttribute.raw, smartAttribute.raw.Length);
                    smartThreshold.id          = smart_Info_Request.SmartInfo[(int)num].Id;
                    smartThreshold.value       = smart_Info_Request.SmartInfo[(int)num].ThresholdValue;
                    smart.attributes[(int)num] = smartAttribute;
                    smart.thresholds[(int)num] = smartThreshold;
                }
            }
            return(MarvellUtil.ToStorApiStatus(b));
        }
Beispiel #3
0
 public virtual StorApiStatus GetSmart(ref SmartInfo smart)
 {
     return(StorApiStatusEnum.STOR_NOT_SUPPORTED);
 }