public SmppPduDataSmResp(uint sequenceId, SmppCommandStatus status, string messageId, SmppOptionalParameter[] optionalParameters = null)
     : base(SmppCommandType.data_sm_resp, sequenceId, status, messageId)
 {
     offsetOptionalParameters = CurrentOffset;
     if (optionalParameters != null)
         WriteOptionalParameters(optionalParameters);
 }
        public SmppPduAlertNotification(byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte esmeAddrTon, byte esmeAddrNpi, string esmeAddr, SmppOptionalParameter[] optionalParameters = null)
            : base(SmppCommandType.alert_notification)
        {
            offsetSourceAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetSourceAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (sourceAddr.Length > 64) throw new ArgumentOutOfRangeException("sourceAddr");
            offsetSourceAddr = CurrentOffset;
            WriteCString(sourceAddr);

            offsetEsmeAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetEsmeAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (esmeAddr.Length > 64) throw new ArgumentOutOfRangeException("esmeAddr");
            offsetEsmeAddr = CurrentOffset;
            WriteCString(esmeAddr);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
 public SmppPduSubmitSm(string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
     byte esmClass, byte protocolId, byte priorityFlag, string scheduleDeliveryTime, string validityPeriod, byte registeredDelivery, byte replaceIfPresentFlag,
     byte dataCoding, byte smDefaultMsgId, /*byte smLength,*/ string shortMessage, SmppOptionalParameter[] optionalParameters = null)
     : base(SmppCommandType.submit_sm, serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destAddr, esmClass, protocolId,
     priorityFlag, scheduleDeliveryTime, validityPeriod, registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, /*smLength,*/ shortMessage, 
     optionalParameters)
 {
 }
        public SmppPduBindRespBase(SmppCommandType commandType, uint sequenceId, SmppCommandStatus status, string systemId, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType, status, sequenceId)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (systemId.Length > 15) throw new ArgumentOutOfRangeException("systemId");
            offsetSystemId = CurrentOffset;
            WriteCString(systemId);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
        public SmppPduDataSm(string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
            byte esmClass, byte registeredDelivery, byte dataCoding, SmppOptionalParameter[] optionalParameters = null)
            : base(SmppCommandType.data_sm)
        {
            if (serviceType.Length > 5) throw new ArgumentOutOfRangeException("systemType");
            offsetServiceType = CurrentOffset;
            WriteCString(serviceType);

            offsetSourceAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetSourceAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (sourceAddr.Length > 20) throw new ArgumentOutOfRangeException("sourceAddr");
            offsetSourceAddr = CurrentOffset;
            WriteCString(sourceAddr);

            offsetDestAddrTon = CurrentOffset;
            WriteByte(destAddrTon);

            offsetDestAddrNpi = CurrentOffset;
            WriteByte(destAddrNpi);

            if (destAddr.Length > 20) throw new ArgumentOutOfRangeException("destAddr");
            offsetDestAddr = CurrentOffset;
            WriteCString(destAddr);

            offsetEsmClass = CurrentOffset;
            WriteByte(esmClass);

            offsetRegisteredDelivery = CurrentOffset;
            WriteByte(registeredDelivery);

            offsetDataCoding = CurrentOffset;
            WriteByte(dataCoding);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
        public SmppPduSmBase(SmppCommandType commandType, string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
            byte esmClass, byte protocolId, byte priorityFlag, string scheduleDeliveryTime, string validityPeriod, byte registeredDelivery, byte replaceIfPresentFlag,
            byte dataCoding, byte smDefaultMsgId, /*byte smLength,*/ string shortMessage, SmppOptionalParameter[] optionalParameters = null)
            : base(commandType)
        {
            if (commandType != GetCommandType()) throw new Exception("Invaid command ID");

            if (serviceType.Length > 5) throw new ArgumentOutOfRangeException("systemType");
            offsetServiceType = CurrentOffset;
            WriteCString(serviceType);

            offsetSourceAddrTon = CurrentOffset;
            WriteByte(sourceAddrTon);

            offsetSourceAddrNpi = CurrentOffset;
            WriteByte(sourceAddrNpi);

            if (sourceAddr.Length > 20) throw new ArgumentOutOfRangeException("sourceAddr");
            offsetSourceAddr = CurrentOffset;
            WriteCString(sourceAddr);

            offsetDestAddrTon = CurrentOffset;
            WriteByte(destAddrTon);

            offsetDestAddrNpi = CurrentOffset;
            WriteByte(destAddrNpi);

            if (destAddr.Length > 20) throw new ArgumentOutOfRangeException("destAddr");
            offsetDestAddr = CurrentOffset;
            WriteCString(destAddr);

            offsetEsmClass = CurrentOffset;
            WriteByte(esmClass);

            offsetProtocolId = CurrentOffset;
            WriteByte(protocolId);

            offsetPriorityFlag = CurrentOffset;
            WriteByte(priorityFlag);

            if (scheduleDeliveryTime.Length != 0 && scheduleDeliveryTime.Length != 16) throw new ArgumentOutOfRangeException("scheduleDeliveryTime");
            offsetScheduleDeliveryTime = CurrentOffset;
            WriteCString(scheduleDeliveryTime);

            if (validityPeriod.Length != 0 && validityPeriod.Length != 16) throw new ArgumentOutOfRangeException("validityPeriod");
            offsetValidityPeriod = CurrentOffset;
            WriteCString(validityPeriod);

            offsetRegisteredDelivery = CurrentOffset;
            WriteByte(registeredDelivery);

            offsetReplaceIfPresentFlag = CurrentOffset;
            WriteByte(replaceIfPresentFlag);

            offsetDataCoding = CurrentOffset;
            WriteByte(dataCoding);

            offsetSmDefaultMsgId = CurrentOffset;
            WriteByte(smDefaultMsgId);

            if (DataEncoder.GetByteCount(shortMessage) > 254) throw new ArgumentOutOfRangeException("smLength");
            offsetSmLength = CurrentOffset;
            WriteByte((byte)DataEncoder.GetByteCount(shortMessage));

            offsetShortMessage = CurrentOffset;
            WriteString(shortMessage, (byte)DataEncoder.GetByteCount(shortMessage), DataEncoder);

            offsetOptionalParameters = CurrentOffset;
            if (optionalParameters != null)
                WriteOptionalParameters(optionalParameters);
        }
Exemple #7
0
 protected void WriteOptionalParameters(SmppOptionalParameter[] parameters)
 {
     foreach (var parameter in parameters)
     {
         WriteShort((ushort)parameter.Tag);
         WriteShort((ushort)parameter.Length);
         data.Write(parameter.Value, 0, parameter.Length);
     }
 }
 public SmppPduBindReceiverResp(uint sequenceId, SmppCommandStatus status, string systemId, SmppOptionalParameter[] optionalParameters = null)
     : base(SmppCommandType.bind_receiver_resp, sequenceId, status, systemId, optionalParameters)
 {
 }
 public SmppPduDeliverSm(string serviceType, byte sourceAddrTon, byte sourceAddrNpi, string sourceAddr, byte destAddrTon, byte destAddrNpi, string destAddr,
     byte esmClass, byte protocolId, byte priorityFlag, byte registeredDelivery, byte dataCoding, /*byte smLength,*/ string shortMessage, SmppOptionalParameter[] optionalParameters = null)
     : base(SmppCommandType.deliver_sm, serviceType, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destAddr, esmClass, protocolId,
     priorityFlag, "", "", registeredDelivery, 0, dataCoding, 0, /*smLength,*/ shortMessage, optionalParameters)
 {
 }