Esempio n. 1
0
            public override byte[] GetEncoded()
            {
                byte[] localArray = new byte[this.PacketLength];
                byte[] arr        = base.GetEncoded();
                int    idx        = arr.Length;

                arr.CopyTo(localArray, 0);

                SupportOperations.ToBigEndian(ServiceId).CopyTo(localArray, idx);
                idx += 8;

                return(localArray);
            }
Esempio n. 2
0
            public override byte[] GetEncoded()
            {
                byte[] localArray = new byte[this.PacketLength];
                byte[] arr        = base.GetEncoded();
                int    idx        = arr.Length;

                arr.CopyTo(localArray, 0);
                ASCIIEncoding ascii = new ASCIIEncoding();
                Encoding      w1251 = Encoding.GetEncoding(1251);

                SupportOperations.ToBigEndian(RequestId).CopyTo(localArray, idx);
                idx += 8;

                ascii.GetBytes(DestinationAddr).CopyTo(localArray, idx);
                idx += ascii.GetByteCount(DestinationAddr);
                localArray[idx++] = 0;

                localArray[idx++] = (byte)ServiceState;

                SupportOperations.ToBigEndian(ServiceTypeId).CopyTo(localArray, idx);
                idx += 8;

                w1251.GetBytes(ServiceClass).CopyTo(localArray, idx);
                idx += w1251.GetByteCount(ServiceClass);
                localArray[idx++] = 0;

                w1251.GetBytes(ServiceDescr).CopyTo(localArray, idx);
                idx += w1251.GetByteCount(ServiceDescr);
                localArray[idx++] = 0;

                SupportOperations.ToBigEndian(ServiceCost).CopyTo(localArray, idx);
                idx += 4;

                localArray[idx++] = (byte)ServicePeriod;

                localArray[idx++] = (byte)ActivationType;

                ascii.GetBytes(ActivationAddr).CopyTo(localArray, idx);
                idx += ascii.GetByteCount(ActivationAddr);
                localArray[idx++] = 0;

                w1251.GetBytes(ActivationMessage).CopyTo(localArray, idx);
                idx += w1251.GetByteCount(ActivationMessage);
                localArray[idx++] = 0;

                SupportOperations.ToBigEndian(ServiceId).CopyTo(localArray, idx);
                idx += 8;

                return(localArray);
            }
Esempio n. 3
0
            public override uint Parse(byte[] msg)
            {
                int  pos       = (int)base.Parse(msg);
                uint cmdLength = SupportOperations.FromBigEndianUInt(msg);
                int  newpos    = 0;

                byte[]        localArray;
                ASCIIEncoding ascii = new ASCIIEncoding();

                ServiceType = SupportOperations.getStringValue(msg, pos, out newpos);
                localArray  = new byte[msg.Length - newpos];
                Array.Copy(msg, newpos, localArray, 0, msg.Length - newpos);
                pos        = newpos + (int)Source.Parse(localArray);
                localArray = new byte[msg.Length - pos];
                Array.Copy(msg, pos, localArray, 0, msg.Length - pos);
                pos               += (int)Destination.Parse(localArray);
                EsmClass           = msg[pos++];
                RegisteredDelivery = msg[pos++];
                DataCoding         = (dataCodingEnum)Enum.Parse(typeof(dataCodingEnum), msg[pos++].ToString());
                // parse optional params
                localArray = new byte[2];
                while (pos < cmdLength)
                {
                    OptionalParameter op = new OptionalParameter();
                    Array.Copy(msg, pos, localArray, 0, 2);
                    op.Param = (OptionalParameter.tagEnum)Enum.Parse(typeof(OptionalParameter.tagEnum), SupportOperations.FromBigEndianUShort(localArray).ToString());
                    pos     += 2;
                    Array.Copy(msg, pos, localArray, 0, 2);
                    op.Length = SupportOperations.FromBigEndianUShort(localArray);
                    pos      += 2;
                    op.Value  = new byte[op.Length];
                    Array.Copy(msg, pos, op.Value, 0, op.Length);
                    pos += op.Length;
                    OptionalParamList.Add(op);
                }
                return((uint)pos);
            }
Esempio n. 4
0
            public override uint Parse(byte[] msg)
            {
                int pos = (int)base.Parse(msg);

                if (pos == 0)
                {
                    return(0);
                }

                byte[] localArray = new byte[8];

                try
                {
                    Array.Copy(msg, pos, localArray, 0, 8);
                    ServiceId = SupportOperations.FromBigEndianULong(localArray);
                }
                catch
                {
                    ServiceId = 0;
                }
                pos += msg.Length;

                return((uint)pos);
            }
Esempio n. 5
0
            public override uint Parse(byte[] msg)
            {
                int pos = (int)base.Parse(msg);
                int newpos;

                if (pos == 0)
                {
                    return(0);
                }

                byte[] localArray = new byte[8];

                Array.Copy(msg, pos, localArray, 0, 8);
                RequestId = SupportOperations.FromBigEndianULong(localArray);
                pos      += 8;


                DestinationAddr = SupportOperations.getStringValue(msg, pos, out newpos);
                pos             = newpos;


                ServiceState = (serviceStateEnum)msg[pos];
                pos++;


                Array.Copy(msg, pos, localArray, 0, 8);
                ServiceTypeId = SupportOperations.FromBigEndianULong(localArray);
                pos          += 8;


                ServiceClass = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos          = newpos;


                ServiceDescr = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos          = newpos;


                Array.Copy(msg, pos, localArray, 0, 4);
                ServiceCost = SupportOperations.FromBigEndianUInt(localArray);
                pos        += 4;


                ServicePeriod = (servicePeriodEnum)msg[pos];
                pos++;


                ActivationType = (activationTypeEnum)msg[pos];
                pos++;


                ActivationAddr = SupportOperations.getStringValue(msg, pos, out newpos);
                pos            = newpos;


                ActivationMessage = SupportOperations.get1251StringValue(msg, pos, out newpos);
                pos = newpos;


                Array.Copy(msg, pos, localArray, 0, 8);
                ServiceId = SupportOperations.FromBigEndianULong(localArray);
                pos      += 8;

                return((uint)pos);
            }
Esempio n. 6
0
 public RegisterService()
 {
     m_commandId    = commandIdEnum.register_service;
     RequestId      = SupportOperations.GuidToULong(Guid.NewGuid());
     ActivationType = RegisterService.activationTypeEnum.SMS;
 }