Send Command to Simcard via SMPP protocol with EasySMPP API (for example How to update spn)

0

I'm working on an application to send Command-to-Card via smsc for my university's final project. I found a very nice software called EasySMPP and I could send a sms to my Mobile. But I still have not succeeded in sending the command to the card, for example, updating spn I do not know what the values of this function are and how should I fill them. Please explain what they are and how to fill them. Please help me immediately

public int SubmitSM(

byte sourceAddressTon, 
byte sourceAddressNpi, 
sourceAddress,
byte destinationAddressTon,
byte destinationAddressNpi, 
destinationAddress, 
byte esmClass, 
byte protocolId,
byte priorityFlag, 
DateTime sheduleDeliveryTime, 
DateTime validityPeriod, 
byte registeredDelivery,
byte replaceIfPresentFlag,
byte dataCoding,
byte smDefaultMsgId,
byte[] message)
{
try
{
            byte[] _destination_addr;
            byte[] _source_addr;
            byte[] _SUBMIT_SM_PDU;
            byte[] _shedule_delivery_time;
            byte[] _validity_period;
            int _sequence_number;
            int pos;
            byte _sm_length;

            _SUBMIT_SM_PDU = new byte[KernelParameters.MaxPduSize];

            ////////////////////////////////////////////////////////////////////////////////////////////////
            /// Start filling PDU                       

            Tools.CopyIntToArray(0x00000004, _SUBMIT_SM_PDU, 4);
            _sequence_number = smscArray.currentSMSC.SequenceNumber;
            Tools.CopyIntToArray(_sequence_number, _SUBMIT_SM_PDU, 12);


            pos = 16;
            _SUBMIT_SM_PDU[pos] = 0x00; //service_type
            pos += 1;
            _SUBMIT_SM_PDU[pos] = sourceAddressTon;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = sourceAddressNpi;
            pos += 1;
            _source_addr = Tools.ConvertStringToByteArray(Tools.GetString(sourceAddress, 20, ""));
            Array.Copy(_source_addr, 0, _SUBMIT_SM_PDU, pos, _source_addr.Length);
            pos += _source_addr.Length;
            _SUBMIT_SM_PDU[pos] = 0x00;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = destinationAddressTon;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = destinationAddressNpi;
            pos += 1;
            _destination_addr = Tools.ConvertStringToByteArray(Tools.GetString(destinationAddress, 20, ""));
            Array.Copy(_destination_addr, 0, _SUBMIT_SM_PDU, pos, _destination_addr.Length);
            pos += _destination_addr.Length;
            _SUBMIT_SM_PDU[pos] = 0x00;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = esmClass;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = protocolId;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = priorityFlag;
            pos += 1;
            _shedule_delivery_time = Tools.ConvertStringToByteArray(Tools.GetDateString(sheduleDeliveryTime));
            Array.Copy(_shedule_delivery_time, 0, _SUBMIT_SM_PDU, pos, _shedule_delivery_time.Length);
            pos += _shedule_delivery_time.Length;
            _SUBMIT_SM_PDU[pos] = 0x00;
            pos += 1;
            _validity_period = Tools.ConvertStringToByteArray(Tools.GetDateString(validityPeriod));
            Array.Copy(_validity_period, 0, _SUBMIT_SM_PDU, pos, _validity_period.Length);
            pos += _validity_period.Length;
            _SUBMIT_SM_PDU[pos] = 0x00;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = registeredDelivery;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = replaceIfPresentFlag;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = dataCoding;
            pos += 1;
            _SUBMIT_SM_PDU[pos] = smDefaultMsgId;
            pos += 1;

            _sm_length = message.Length > 254 ? (byte)254 : (byte)message.Length;

            _SUBMIT_SM_PDU[pos] = _sm_length;
            pos += 1;
            Array.Copy(message, 0, _SUBMIT_SM_PDU, pos, _sm_length);
            pos += _sm_length;

            Tools.CopyIntToArray(pos, _SUBMIT_SM_PDU, 0);

            Send(_SUBMIT_SM_PDU, pos);

            undeliveredMessages++;
            return _sequence_number;
        }
        catch (Exception ex)
        {
            logMessage(LogLevels.LogExceptions, "SubmitSM | " + ex.ToString());
        }
        return -1;

    }
smpp
asked on Stack Overflow Jul 8, 2019 by mr.develop • edited Jul 8, 2019 by mr.develop

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0