Ejemplo n.º 1
0
        public static byte[] ReadData(uint hDongle, int index, int length)
        {
            //写数据区,匿名和用户权限可写前4k(0~4095),开发商有所有8k的写权限
            byte[] datas = new byte[length];//数据区总大小8k
            uint   ret   = RockeyArmHelper.Dongle_ReadData(hDongle, 4096 + index, datas, length);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }

            return(datas);
        }
Ejemplo n.º 2
0
        public static byte[] ReadData(uint hDongle, int index)
        {
            //写数据区,匿名和用户权限可写前4k(0~4095),开发商有所有8k的写权限
            byte[] dataLengthBytes = new byte[4];//数据区总大小8k
            uint   ret1            = RockeyArmHelper.Dongle_ReadData(hDongle, 4096 + index, dataLengthBytes, 4);

            if (ret1 != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret1));
            }
            int dataLength = BitConverter.ToInt32(dataLengthBytes, 0);

            byte[] datas = new byte[dataLength];//数据区总大小8k
            uint   ret2  = RockeyArmHelper.Dongle_ReadData(hDongle, 4100 + index, datas, datas.Length);

            if (ret2 != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret2));
            }

            return(datas);
        }