ImageActivate() 공개 메소드

public ImageActivate ( Gurux.DLMS.GXDLMSClient client ) : byte[][]
client Gurux.DLMS.GXDLMSClient
리턴 byte[][]
        public void UpdateImage(GXDLMSImageTransfer target, byte[] data, string Identification)
        {
            //Check that image transfer ia enabled.
            byte[] reply = ReadDataBlock(Client.Read(target, 5));
            Client.UpdateValue(reply, target, 5);
            if (!target.ImageTransferEnabled)
            {
                throw new Exception("Image transfer is not enabled");
            }

            //Step 1: The client gets the ImageBlockSize.
            reply = ReadDataBlock(Client.Read(target, 2));
            Client.UpdateValue(reply, target, 2);

            // Step 2: The client initiates the Image transfer process.
            ReadDataBlock(target.ImageTransferInitiate(Client, Identification, data.Length));
            // Step 3: The client transfers ImageBlocks.
            int ImageBlockCount;
            ReadDataBlock(target.ImageBlockTransfer(Client, data, out ImageBlockCount));
            //Step 4: The client checks the completeness of the Image in
            //each server individually and transfers any ImageBlocks not (yet) transferred;
            Client.UpdateValue(reply, target, 2);

            // Step 5: The Image is verified;
            ReadDataBlock(target.ImageVerify(Client));
            // Step 6: Before activation, the Image is checked;

            //Get list to imaages to activate.
            reply = ReadDataBlock(Client.Read(target, 7));
            Client.UpdateValue(reply, target, 7);
            bool bFound = false;
            foreach (GXDLMSImageActivateInfo it in target.ImageActivateInfo)
            {
                if (it.Identification == Identification)
                {
                    bFound = true;
                    break;
                }
            }

            //Read image transfer status.
            reply = ReadDataBlock(Client.Read(target, 6));
            Client.UpdateValue(reply, target, 6);
            if (target.ImageTransferStatus != ImageTransferStatus.VerificationSuccessful)
            {
                throw new Exception("Image transfer status is " + target.ImageTransferStatus.ToString());
            }

            if (!bFound)
            {
                throw new Exception("Image not found.");
            }

            //Step 7: Activate image.
            ReadDataBlock(target.ImageActivate(Client));
        }