Click here to Skip to main content
15,885,659 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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


C#
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;

    }


What I have tried:

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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900