Пример #1
0
        public BaseResult <SMSSendResult> Send(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);

            GSMCommunication.Feature.SMS sms    = new GSMCommunication.Feature.SMS(param.TryGet <BasicInformation>("base"));
            BaseResult <SMSSendResult>   result = null;

            result = sms.Send(param.TryGet <string>("message"), param.TryGet <string>("number"));
            if (result != null)
            {
                result.ID = param.TryGet <string>("id");

                IInternalLogging logging    = ObjectPool.Instance.Resolve <IInternalLogging>();
                ISMSLogging      smsLogging = ObjectPool.Instance.Resolve <ISMSLogging>();

                if (logging != null)
                {
                    logging.Write(result);
                }
                if (smsLogging != null)
                {
                    smsLogging.Send(result);
                }
            }

            return(result);
        }
Пример #2
0
        public BaseResult<GenericTypeResult<bool>> Delete(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);
            GSMCommunication.Feature.SMS sms = new GSMCommunication.Feature.SMS(param.TryGet<BasicInformation>("base"));
            BaseResult<GenericTypeResult<bool>> result = sms.Delete(param.TryGet<int>("index"));
            result.ID = param.TryGet<string>("id");

            IInternalLogging logging = ObjectPool.Instance.Resolve<IInternalLogging>();
            if (logging != null)
                logging.Write(result);

            return result;
        }
Пример #3
0
        public List<BaseResult<SMSReadResult>> ReadAll(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);
            GSMCommunication.Feature.SMS sms = new GSMCommunication.Feature.SMS(param.TryGet<BasicInformation>("base"));
            List<BaseResult<SMSReadResult>> result = sms.Read(SMSStatus.AllMessages);

            IInternalLogging logging = ObjectPool.Instance.Resolve<IInternalLogging>();
            ISMSLogging smsLogging = ObjectPool.Instance.Resolve<ISMSLogging>();
             
            if (smsLogging != null)
                smsLogging.Read(result); 

            return result;
        }
Пример #4
0
        public List <BaseResult <SMSReadResult> > ReadAll(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);

            GSMCommunication.Feature.SMS       sms    = new GSMCommunication.Feature.SMS(param.TryGet <BasicInformation>("base"));
            List <BaseResult <SMSReadResult> > result = sms.Read(SMSStatus.AllMessages);

            IInternalLogging logging    = ObjectPool.Instance.Resolve <IInternalLogging>();
            ISMSLogging      smsLogging = ObjectPool.Instance.Resolve <ISMSLogging>();

            if (smsLogging != null)
            {
                smsLogging.Read(result);
            }

            return(result);
        }
Пример #5
0
        public BaseResult <GenericTypeResult <bool> > Delete(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);

            GSMCommunication.Feature.SMS           sms    = new GSMCommunication.Feature.SMS(param.TryGet <BasicInformation>("base"));
            BaseResult <GenericTypeResult <bool> > result = sms.Delete(param.TryGet <int>("index"));

            result.ID = param.TryGet <string>("id");

            IInternalLogging logging = ObjectPool.Instance.Resolve <IInternalLogging>();

            if (logging != null)
            {
                logging.Write(result);
            }

            return(result);
        }
Пример #6
0
        public BaseResult<SMSSendResult> Send(ParameterizedMap map)
        {
            UnboxParameterizedMap param = new UnboxParameterizedMap(map);
            GSMCommunication.Feature.SMS sms = new GSMCommunication.Feature.SMS(param.TryGet<BasicInformation>("base"));
            BaseResult<SMSSendResult> result = null;
            result = sms.Send(param.TryGet<string>("message"), param.TryGet<string>("number"));
            if (result != null)
            {
                result.ID = param.TryGet<string>("id");

                IInternalLogging logging = ObjectPool.Instance.Resolve<IInternalLogging>();
                ISMSLogging smsLogging = ObjectPool.Instance.Resolve<ISMSLogging>();

                if (logging != null)
                    logging.Write(result);
                if (smsLogging != null)
                    smsLogging.Send(result); 

            }
                
            return result;
        }
Пример #7
0
        private void InitSerialPort(BasicInformation connection)
        {
            //// let the connection remains open until the server is closed/disposed
            connection.Connector.Open();

            connection.OnBeginExecuting();
 
            BaseResult<GenericTypeResult<string>> manufacturer = connection.GetManufacturer();
            if (!string.IsNullOrEmpty(manufacturer.Response.Result))
            {
                connection.GetServiceCenter();
                connection.SetErrorMessageFormat(1);
                connection.GetOperator();

                PhoneBook pb = new PhoneBook(connection);
                pb.SetPhoneBookMemory(MemoryStorage.SIMOwnNumber);
                pb.GetInfo();

                SMS sms = new SMS(connection);
                sms.SetMessageStorage(MemoryStorage.MobilePhonebook, MemoryStorage.MobilePhonebook, MemoryStorage.MobilePhonebook);
                sms.SetMessageFormat(connection.PDUMode);

                string prefixOwnNumber = string.Empty;
                if (string.IsNullOrEmpty(prefixOwnNumber))
                {
                    GSMServer.Configuration.IConfiguration configuration = ObjectPool.Instance.Resolve<GSMServer.Configuration.IConfiguration>();
                    prefixOwnNumber = ((ApplicationSettings)configuration).General.PrefixOwnNumber;
                }

                BaseResult<GenericTypeResult<List<PhoneNumberInfo>>> list = pb.ReadPhoneBook(MemoryStorage.SIMOwnNumber, 1, -1);
                if (list.Response.Result.Count > 0)
                {
                    foreach (PhoneNumberInfo info in list.Response.Result)
                    {
                        if (info.Name.Equals(prefixOwnNumber))
                        {
                            connection.OwnNumber = info.PhoneNumber;
                            break;
                        }
                    }
                }
                portColletion.Add(connection);
            }
            connection.OnEndExecuting();
        }