/// <summary>
        /// SetThreshold<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int SetThreshold(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;

            sendData = new byte[32];

            sendData[0] = unchecked ((byte)(param.Body.Threshold & 0xff));
            sendData[1] = unchecked ((byte)((param.Body.Threshold >> 8) & 0xff));
            sendData[2] = unchecked ((byte)(param.Hand.Threshold & 0xff));
            sendData[3] = unchecked ((byte)((param.Hand.Threshold >> 8) & 0xff));
            sendData[4] = unchecked ((byte)(param.Face.Threshold & 0xff));
            sendData[5] = unchecked ((byte)((param.Face.Threshold >> 8) & 0xff));
            sendData[6] = 0;
            sendData[7] = 0;
            /* Send SetThreshold command signal */
            nRet = SendCommand(HVC_COM_SET_THRESHOLD, 8, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }
            return(HVC_NORMAL);
        }
        /// <summary>
        /// GetCameraAngle<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int GetCameraAngle(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;
            byte[] recvData;

            sendData = new byte[32];
            recvData = new byte[32];

            /* Send GetCameraAngle command signal */
            nRet = SendCommand(HVC_COM_GET_CAMERA_ANGLE, 0, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }

            if (nSize[0] > 1)
            {
                nSize[0] = 1;
            }

            /* Receive data */
            nRet = ReceiveData(inTimeOutTime, nSize[0], recvData);
            param.CameraAngle = (HVC_PRM.HVC_CAMERA_ANGLE)recvData[0];
            return(nRet);
        }
        /// <summary>
        /// SetCameraAngle<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int SetCameraAngle(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;

            sendData = new byte[32];

            sendData[0] = unchecked ((byte)((int)param.CameraAngle & 0xff));
            /* Send SetCameraAngle command signal */
            nRet = SendCommand(HVC_COM_SET_CAMERA_ANGLE, 1, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }
            return(HVC_NORMAL);
        }
        public async override Task <int> GetParam(HVC_PRM prm)
        {
            if (BtDevice == null)
            {
                Debug.WriteLine(TAG, "getParam() : HVC_ERROR_NODEVICES");
                return(HVC_ERROR_NODEVICES);
            }
            if (Service == null || Service.GetmConnectionState() != BleDeviceService.STATE_CONNECTED)
            {
                Debug.WriteLine(TAG, "getParam() : HVC_ERROR_DISCONNECTED");
                return(HVC_ERROR_DISCONNECTED);
            }
            if (Status > STATE_CONNECTED)
            {
                Debug.WriteLine(TAG, "getParam() : HVC_ERROR_BUSY");
                return(HVC_ERROR_BUSY);
            }

            Status = STATE_BUSY;

            await Task.Run(() =>
            {
                int nRet         = HVC_NORMAL;
                byte[] outStatus = new byte[1];
                if (nRet == HVC_NORMAL)
                {
                    nRet = GetCameraAngle(10000, outStatus, prm);
                }
                if (nRet == HVC_NORMAL)
                {
                    nRet = GetThreshold(10000, outStatus, prm);
                }
                if (nRet == HVC_NORMAL)
                {
                    nRet = GetSizeRange(10000, outStatus, prm);
                }
                if (nRet == HVC_NORMAL)
                {
                    nRet = GetFaceDetectionAngle(10000, outStatus, prm);
                }
                if (Callback != null)
                {
                    Callback.OnPostGetParam(nRet, outStatus[0]);
                }

                if (Status == STATE_BUSY)
                {
                    Status = STATE_CONNECTED;
                }
            });

            Debug.WriteLine(TAG, "getParam() : HVC_NORMAL");
            return(HVC_NORMAL);
        }
        /// <summary>
        /// GetSizeRange<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int GetSizeRange(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;
            byte[] recvData;

            sendData = new byte[32];
            recvData = new byte[32];

            /* Send GetSizeRange command signal */
            nRet = SendCommand(HVC_COM_GET_SIZE_RANGE, 0, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }

            if (nSize[0] > 12)
            {
                nSize[0] = 12;
            }

            /* Receive data */
            nRet = ReceiveData(inTimeOutTime, nSize[0], recvData);
            param.Body.MinSize = recvData[0] + (recvData[1] << 8);
            param.Body.MaxSize = recvData[2] + (recvData[3] << 8);
            param.Hand.MinSize = recvData[4] + (recvData[5] << 8);
            param.Hand.MaxSize = recvData[6] + (recvData[7] << 8);
            param.Face.MinSize = recvData[8] + (recvData[9] << 8);
            param.Face.MaxSize = recvData[10] + (recvData[11] << 8);
            return(nRet);
        }
        /// <summary>
        /// GetThreshold<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int GetThreshold(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;
            byte[] recvData;

            sendData = new byte[32];
            recvData = new byte[32];

            /* Send GetThreshold command signal */
            nRet = SendCommand(HVC_COM_GET_THRESHOLD, 0, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }

            if (nSize[0] > 8)
            {
                nSize[0] = 8;
            }

            /* Receive data */
            nRet = ReceiveData(inTimeOutTime, nSize[0], recvData);
            param.Body.Threshold = recvData[0] + (recvData[1] << 8);
            param.Hand.Threshold = recvData[2] + (recvData[3] << 8);
            param.Face.Threshold = recvData[4] + (recvData[5] << 8);
            return(nRet);
        }
        /// <summary>
        /// SetSizeRange<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int SetSizeRange(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;

            sendData = new byte[32];

            sendData[0]  = unchecked ((byte)(param.Body.MinSize & 0xff));
            sendData[1]  = unchecked ((byte)((param.Body.MinSize >> 8) & 0xff));
            sendData[2]  = unchecked ((byte)(param.Body.MaxSize & 0xff));
            sendData[3]  = unchecked ((byte)((param.Body.MaxSize >> 8) & 0xff));
            sendData[4]  = unchecked ((byte)(param.Hand.MinSize & 0xff));
            sendData[5]  = unchecked ((byte)((param.Hand.MinSize >> 8) & 0xff));
            sendData[6]  = unchecked ((byte)(param.Hand.MaxSize & 0xff));
            sendData[7]  = unchecked ((byte)((param.Hand.MaxSize >> 8) & 0xff));
            sendData[8]  = unchecked ((byte)(param.Face.MinSize & 0xff));
            sendData[9]  = unchecked ((byte)((param.Face.MinSize >> 8) & 0xff));
            sendData[10] = unchecked ((byte)(param.Face.MaxSize & 0xff));
            sendData[11] = unchecked ((byte)((param.Face.MaxSize >> 8) & 0xff));
            /* Send SetSizeRange command signal */
            nRet = SendCommand(HVC_COM_SET_SIZE_RANGE, 12, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }
            return(HVC_NORMAL);
        }
        /// <summary>
        /// GetFaceDetectionAngle<br>
        /// [Description]<br>
        /// none<br>
        /// [Notes]<br> </summary>
        /// <param name="inTimeOutTime"> timeout time<br> </param>
        /// <param name="outStatus"> response code<br> </param>
        public virtual int GetFaceDetectionAngle(int inTimeOutTime, byte[] outStatus, HVC_PRM param)
        {
            int nRet = 0;

            int[]  nSize = { 0 };
            byte[] sendData;
            byte[] recvData;

            sendData = new byte[32];
            recvData = new byte[32];

            /* Send GetFaceDetectionAngle signal command */
            nRet = SendCommand(HVC_COM_GET_DETECTION_ANGLE, 0, sendData);
            if (nRet != 0)
            {
                return(nRet);
            }

            /* Receive header */
            nRet = ReceiveHeader(inTimeOutTime, nSize, outStatus);
            if (nRet != 0)
            {
                return(nRet);
            }

            if (nSize[0] > 2)
            {
                nSize[0] = 2;
            }

            /* Receive data */
            nRet             = ReceiveData(inTimeOutTime, nSize[0], recvData);
            param.Face.Pose  = (HVC_PRM.HVC_FACE_POSE)recvData[0];
            param.Face.Angle = (HVC_PRM.HVC_FACE_ANGLE)recvData[1];
            return(nRet);
        }
 public abstract Task <int> GetParam(HVC_PRM prm);