示例#1
0
        internal static MiscVersionInformation ConvertVersionStruct(MiscVersionInfoStruct infoStruct)
        {
            MiscVersionInformation versionInfo = new MiscVersionInformation();

            versionInfo.CalcDate  = infoStruct.CalDate;
            versionInfo.EriNamNum = infoStruct.EriNam;
            versionInfo.EriVers   = infoStruct.EriVersion;
            versionInfo.HwVers    = infoStruct.HwVersion;
            versionInfo.SwVers    = infoStruct.SwVersion;
            versionInfo.PrlNamNum = infoStruct.PrlNam;
            versionInfo.PrlVers   = infoStruct.PrlVersion;
            versionInfo.ProdCode  = infoStruct.ProductCode;
            versionInfo.Version   = infoStruct.Mask;
            versionInfo.Model     = infoStruct.ModelId;
            return(versionInfo);
        }
示例#2
0
        /// <summary>
        /// Get Me version information asynchronously.
        /// </summary>
        /// <returns>Instance of MiscVersionInformation.</returns>
        /// <privilege>http://tizen.org/privilege/telephony</privilege>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
        /// <exception cref="System.UnauthorizedAccessException">Thrown when privilege access is denied.</exception>
        /// <exception cref="System.InvalidOperationException">Thrown when modem instance is invalid or when method failed due to invalid operation.</exception>
        public Task <MiscVersionInformation> GetMiscMeVersion()
        {
            TaskCompletionSource <MiscVersionInformation> task = new TaskCompletionSource <MiscVersionInformation>();
            IntPtr id;

            id = (IntPtr)_requestId++;
            _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) =>
            {
                Task resultTask = new Task(() =>
                {
                    if (result != (int)TapiError.Success)
                    {
                        Log.Error(TapiUtility.LogTag, "Error occurs during getting the Me version, " + (TapiError)result);
                        task.SetException(new InvalidOperationException("Error occurs during getting the Me version, " + (TapiError)result));
                        return;
                    }

                    MiscVersionInfoStruct infoStruct        = Marshal.PtrToStructure <MiscVersionInfoStruct>(data);
                    MiscVersionInformation versionInfoClass = ModemStructConversions.ConvertVersionStruct(infoStruct);
                    task.SetResult(versionInfoClass);
                });

                resultTask.Start();
                resultTask.Wait();
                _response_map.Remove(key);
            };

            int ret = Interop.Tapi.Modem.GetMiscMeVersion(_handle, _response_map[id], id);

            if (ret != (int)TapiError.Success)
            {
                Log.Error(TapiUtility.LogTag, "Failed to get the Me version information, Error: " + (TapiError)ret);
                TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony");
            }

            return(task.Task);
        }