コード例 #1
0
        public Message(string smsc, string address, string content, int port)
        {
            _corn = new SMSP.SubmitMessage(Protocols.GsmDataCoding.Ascii);

            _corn.Data = Encoding.ASCII.GetBytes(content);
            if (_corn.Data.Length > 134)
            {
                throw new NotSupportedException("Long Message Not Supported.");
            }

            _corn.CenterAddress = new SMSP.Address(
                SMSP.DataRepresentation.Octet,
                SMSP.NumberType.InternationalNumber,
                SMSP.NumberingPlan.IsdnOrTelephone,
                smsc);
            _corn.DestinationAddress = new SMSP.Address(
                SMSP.DataRepresentation.SemiOctet,
                SMSP.NumberType.InternationalNumber,
                SMSP.NumberingPlan.IsdnOrTelephone,
                address);

            _Address = Encoding.ASCII.GetBytes(address);
            _Content = Encoding.ASCII.GetBytes(content);
            _Port    = port;
            _Coding  = Protocols.GsmDataCoding.Ascii;
        }
コード例 #2
0
        public Message(GSMS.ShortMessage message)
        {
            SMSP.DeliverMessage ms = new SMSP.DeliverMessage(message.Content);
            _Address = Encoding.ASCII.GetBytes(ms.OriginatingAddress.Number);
            _Content = ms.Data;
            _Coding  = ms.DataCodingScheme.MessageCoding;

            _Port = ms.DataHeaderIndication == Protocols.SMS.DataHeaderIndication.Yes ? 16001 : 0;
        }