Migration from v1.x to 2.x
How to solve some compile issues:
SmppClient
- The events
evBindComplete,evSubmitComplete,evQueryCompletehave been deprecated. You should use async await pattern with the methods BindAsync, SubmitAsync, QueryAsync.
public async Task SubmitBatchAsync(List<SubmitSm> batch)
{
IEnumerable<SubmitSmResp> responses = await _client.SubmitAsync(batch).ConfigureAwait(false);
}
or handle the response with ContinueWith
_client.SubmitAsync(submitSm).ContinueWith(t =>
{
if (t.IsFaulted)
{
var error = t.Exception;
}
else
{
//get SUBMIT_SM_RESP
SubmitSmResp resp = t.Result;
}
});
- Missing
BatchMonitorclass. Use instead SubmitAsync(IEnumerable<SubmitSm>). It waits until all responses for the batch are received.
Tip
Awaiting for each single SubmtiSmResp can reduce the performance. You can create a batch of SubmitSm PDUs and send all of them with one SubmitAsync(IEnumerable<SubmitSm>) call.
_client.AddressRange,_client.AddrNpiand_client.AddrTonmust be specified as
_client.EsmeAddress = new SmeAddress(AddressRange, AddrTon, AddrNpi);
- Sequence number and Command Status are moved to Header property of the PDU.
data.Statusreplaced withdata.Header.Status,data.Sequencereplaced withdata.Header.Sequence
client.GetMessageTextis moved toclient.EncodingMapper.GetMessageTextPDU Properties
SourceAddrTon,SourceAddrNpi,SourceAddrreplaced with SourceAddress of type SmeAddressDestAddrTon,DestAddrNpi,DestAddrreplaced with DestinationAddress of type SmeAddressUserDataPdureplaced with UserDataOptionalreplaced with Parameters
Property
MessageTextinSubmitSm,SubmitMulti,DeliverSm,DataSm,ReplaceSmclasses is deprecated. Use the methodpdu.GetMessageText(client.EncodingMapper).Method
SmppClientBase.MapEncodingmoved toSmppClientBase.EncodingMapper.MapEncoding
SmppServer
Namespace for
SmppServerClientclass changed toInetlab.SMPP.IPEndPoint of the server must be specified in
SmppServerconstructor, instead ofStartmethod of this class.
Serialization
Method submitSm.Serialize can be replaced with extension method:
byte[] pduData = submitSm.Serialize(_client.EncodingMapper);
Static method SubmitSm.Deserialize can be replaced with code:
byte[] pduData = ReadFromDataReader();
SubmitSm submitSm = pduData.Deserialize<SubmitSm>(_client.EncodingMapper);