Example #1
0
        private void SetConditionDataToDrives()
        {
            //Ściąga językowa - vendor specific jako dostawca
            SmartObjectHelper helper;

            driveIndex      = 0;
            queryCollection = connectionService.GetQueryCollectionFromDiskDrive("MSStorageDriver_FailurePredictData");

            foreach (ManagementObject drivePredictData in queryCollection)
            {
                //Wszystkie dane zakodowane są na poszczególnych pozycjach pozyskanej tablicy bitów
                Byte[] byteArray = (Byte[])drivePredictData.Properties["VendorSpecific"].Value;
                for (int i = 0; i < 30; ++i)
                {
                    try
                    {
                        helper = new SmartObjectHelper();

                        //Co 12 bitów zmienia się argument, a jego id znajduje się na pozycji 2
                        helper.id = byteArray[i * 12 + 2];
                        if (helper.id == 0)
                        {
                            continue;
                        }

                        helper.flags           = byteArray[i * 12 + 4]; //określa najmłodszy bit statusu, pozostała reszta jest ignorowana
                        helper.failureIsComing = (helper.flags & 0x1) == 0x1;
                        helper.value           = byteArray[i * 12 + 5];
                        helper.worst           = byteArray[i * 12 + 6];
                        helper.vendorData      = BitConverter.ToInt32(byteArray, i * 12 + 7);

                        var currentAttribute = allDrivesDictionary[driveIndex].Attributes[helper.id];

                        currentAttribute.Current = helper.value;
                        currentAttribute.Worst   = helper.worst;
                        currentAttribute.Data    = helper.vendorData;
                        if (helper.failureIsComing == false)
                        {
                            currentAttribute.Status = true;
                        }
                        else
                        {
                            currentAttribute.Status = false;
                        }
                    }
                    catch
                    {
                        //Podane id nie zostało uwzględnione pośród wymienionych atrybutów (DriveData)
                    }
                }
                driveIndex++;
            }
        }
Example #2
0
        private void SetThresholdsToDrives()
        {
            SmartObjectHelper helper;

            driveIndex      = 0;
            queryCollection = connectionService.GetQueryCollectionFromDiskDrive("MSStorageDriver_FailurePredictThresholds");

            foreach (ManagementObject drivePredictData in queryCollection)
            {
                //Wszystkie dane zakodowane są na poszczególnych pozycjach pozyskanej tablicy bitów
                Byte[] byteArray = (Byte[])drivePredictData.Properties["VendorSpecific"].Value;
                for (int i = 0; i < 30; ++i)
                {
                    try
                    {
                        helper    = new SmartObjectHelper();
                        helper.id = byteArray[i * 12 + 2];
                        if (helper.id == 0)
                        {
                            continue;
                        }

                        helper.threshold = byteArray[i * 12 + 3];

                        var currentAttribute = allDrivesDictionary[driveIndex].Attributes[helper.id];

                        currentAttribute.Threshold = helper.threshold;
                    }
                    catch
                    {
                        //Podane id nie zostało uwzględnione pośród wymienionych atrybutów (DriveData)
                    }
                }

                driveIndex++;
            }
        }