Example #1
0
        public string SimCard_readSMS(string comstr)
        {
            IntPtr handle = InitSIMCard(comstr);

            if (IntPtr.Zero == handle)
            {
                return(string.Empty);
            }

            int    smsnumber = 0;
            IntPtr sms       = IntPtr.Zero;
            var    r         = SIMCoreAPI.SimCard_readSMS(handle, ref sms, ref smsnumber);

            List <SIMStruct_SMS> list = new List <SIMStruct_SMS>();

            if (r == 0 && IntPtr.Zero != sms && smsnumber > 0)
            {
                var temp = sms;
                for (int i = 0; i < smsnumber; i++)
                {
                    try
                    {
                        list.Add(temp.ToStruct <SIMStruct_SMS>());

                        temp = temp.Increment <SIMStruct_SMS>();
                    }
                    catch
                    {
                    }
                }
            }

            SIMCoreAPI.Simcard_releaseBuffer(ref sms);
            SIMCoreAPI.Simcard_unmount(ref handle);

            return(string.Empty);
        }
Example #2
0
        public string SimCard_readAddressbook(string comstr)
        {
            IntPtr handle = InitSIMCard(comstr);

            if (IntPtr.Zero == handle)
            {
                return(string.Empty);
            }

            int    phonenumber = 0;
            IntPtr lastphone   = IntPtr.Zero;
            var    r           = SIMCoreAPI.SimCard_readAddressbook(handle, ref lastphone, ref phonenumber);

            List <SIMStruct_TelephoneBook> list = new List <SIMStruct_TelephoneBook>();

            if (r == 0 && IntPtr.Zero != lastphone && phonenumber > 0)
            {
                var temp = lastphone;
                for (int i = 0; i < phonenumber; i++)
                {
                    try
                    {
                        list.Add(temp.ToStruct <SIMStruct_TelephoneBook>());

                        temp = temp.Increment <SIMStruct_TelephoneBook>();
                    }
                    catch
                    {
                    }
                }
            }

            SIMCoreAPI.Simcard_releaseBuffer(ref lastphone);
            SIMCoreAPI.Simcard_unmount(ref handle);

            return(string.Empty);
        }
Example #3
0
        public string SimCard_readlastCalled(string comstr)
        {
            IntPtr handle = InitSIMCard(comstr);

            if (IntPtr.Zero == handle)
            {
                return(string.Empty);
            }

            int    callnumber = 0;
            IntPtr call       = IntPtr.Zero;
            var    r          = SIMCoreAPI.SimCard_readlastCalled(handle, ref call, ref callnumber);

            List <SINStruct_LastPhoneDailed> list = new List <SINStruct_LastPhoneDailed>();

            if (r == 0 && IntPtr.Zero != call && callnumber > 0)
            {
                var temp = call;
                for (int i = 0; i < callnumber; i++)
                {
                    try
                    {
                        list.Add(temp.ToStruct <SINStruct_LastPhoneDailed>());

                        temp = temp.Increment <SINStruct_LastPhoneDailed>();
                    }
                    catch
                    {
                    }
                }
            }

            SIMCoreAPI.Simcard_releaseBuffer(ref call);
            SIMCoreAPI.Simcard_unmount(ref handle);

            return(string.Empty);
        }