コード例 #1
0
ファイル: GsmPhone.cs プロジェクト: gbmakaveli/GSMComm
		/// <summary>
		/// AT+CSCA. Gets the SMS Service Center Address.
		/// </summary>
		/// <returns>The current SMSC address</returns>
		/// <remarks>This command returns the SMSC address, through which SMS messages are transmitted.
		/// In text mode, this setting is used by SMS sending and SMS writing commands. In PDU mode, this setting is
		/// used by the same commands, but only when the length of the SMSC address coded into the PDU data equals
		/// zero.</remarks>
		public AddressData GetSmscAddress()
		{
			AddressData addressDatum;
			lock (this)
			{
				this.VerifyValidConnection();
				this.LogIt(LogLevel.Info, "Getting SMSC address...");
				string str = "AT+CSCA?";
				string str1 = this.ExecAndReceiveMultiple(str);
				Regex regex = new Regex("\\+CSCA: \"(.*)\",(\\d+)");
				Match match = regex.Match(str1);
				if (!match.Success)
				{
					this.HandleCommError(str1);
					throw new CommException("Unexpected response.", str1);
				}
				else
				{
					string value = match.Groups[1].Value;
					int num = int.Parse(match.Groups[2].Value);
					object[] objArray = new object[2];
					objArray[0] = value;
					objArray[1] = num.ToString();
					this.LogIt(LogLevel.Info, "address=\"{0}\", typeOfAddress={1}", objArray);
					AddressData addressDatum1 = new AddressData(value, num);
					addressDatum = addressDatum1;
				}
			}
			return addressDatum;
		}
コード例 #2
0
ファイル: GsmPhone.cs プロジェクト: gbmakaveli/GSMComm
		/// <summary>
		/// AT+CSCA. Sets the SMS Service Center Address.
		/// </summary>
		/// <param name="data">An <see cref="T:GsmComm.GsmCommunication.AddressData" /> object containing the new address</param>
		/// <remarks>This command changes the SMSC address, through which SMS messages are transmitted.
		/// In text mode, this setting is used by SMS sending and SMS writing commands. In PDU mode, this setting is
		/// used by the same commands, but only when the length of the SMSC address coded into the PDU data equals
		/// zero.</remarks>
		public void SetSmscAddress(AddressData data)
		{
			lock (this)
			{
				this.VerifyValidConnection();
				object[] address = new object[2];
				address[0] = data.Address;
				int typeOfAddress = data.TypeOfAddress;
				address[1] = typeOfAddress.ToString();
				this.LogIt(LogLevel.Info, "Setting SMSC address to \"{0}\", type {1}...", address);
				int num = data.TypeOfAddress;
				string str = string.Format("AT+CSCA=\"{0}\",{1}", data.Address, num.ToString());
				this.ExecAndReceiveMultiple(str);
			}
		}
コード例 #3
0
ファイル: GsmCommMain.cs プロジェクト: gbmakaveli/GSMComm
		/// <summary>
		/// Sets the new SMS service center address.
		/// </summary>
		/// <param name="data">An <see cref="T:GsmComm.GsmCommunication.AddressData" /> object containing the new address</param>
		/// <remarks>This command changes the SMSC address, through which SMS messages are transmitted.
		/// In text mode, this setting is used by SMS sending and SMS writing commands. In PDU mode, this setting is
		/// used by the same commands, but only when the length of the SMSC address coded into the PDU data equals
		/// zero.</remarks>
		public void SetSmscAddress(AddressData data)
		{
			this.theDevice.SetSmscAddress(data);
		}