Migration from v1.x to 2.x
How to solve some compile issues:
SmppClient
- The events
evBindComplete
,evSubmitComplete
,evQueryComplete
have 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
BatchMonitor
class. 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.AddrNpi
and_client.AddrTon
must be specified as
_client.EsmeAddress = new SmeAddress(AddressRange, AddrTon, AddrNpi);
- Sequence number and Command Status are moved to Header property of the PDU.
data.Status
replaced withdata.Header.Status
,data.Sequence
replaced withdata.Header.Sequence
client.GetMessageText
is moved toclient.EncodingMapper.GetMessageText
PDU Properties
SourceAddrTon
,SourceAddrNpi
,SourceAddr
replaced with SourceAddress of type SmeAddressDestAddrTon
,DestAddrNpi
,DestAddr
replaced with DestinationAddress of type SmeAddressUserDataPdu
replaced with UserDataOptional
replaced with Parameters
Property
MessageText
inSubmitSm
,SubmitMulti
,DeliverSm
,DataSm
,ReplaceSm
classes is deprecated. Use the methodpdu.GetMessageText(client.EncodingMapper)
.Method
SmppClientBase.MapEncoding
moved toSmppClientBase.EncodingMapper.MapEncoding
SmppServer
Namespace for
SmppServerClient
class changed toInetlab.SMPP
.IPEndPoint of the server must be specified in
SmppServer
constructor, instead ofStart
method 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);