Ticket #340: 0001-Preliminary-support-for-SMS-message-delivery-reports.patch

File 0001-Preliminary-support-for-SMS-message-delivery-reports.patch, 4.6 KB (added by PaulFertser, 3 years ago)
  • framework/subsystems/ogsmd/device.py

    From f7ee8f01ffd7fe04c32cd94775054d242174f59d Mon Sep 17 00:00:00 2001
    From: Paul Fertser <fercerpav@gmail.com>
    Date: Mon, 2 Feb 2009 17:10:31 +0300
    Subject: [PATCH] Preliminary support for SMS message delivery reports
    
    I couldn't find enough reliable information for that type of PDU, therefore
    support is incomplete for now.
    ---
     framework/subsystems/ogsmd/device.py               |    5 ++++
     framework/subsystems/ogsmd/gsm/sms.py              |   21 +++++++++++++++----
     .../ogsmd/modems/abstract/unsolicited.py           |    8 +++++++
     3 files changed, 29 insertions(+), 5 deletions(-)
    
    diff --git a/framework/subsystems/ogsmd/device.py b/framework/subsystems/ogsmd/device.py
    index 914fd7d..3a0e898 100644
    a b class Device( resource.Resource ): 
    374374    def IncomingMessage( self, address, text, features ): 
    375375        logger.info( "incoming message (unbuffered) from %s", address ) 
    376376 
     377    @resource.queuedsignal 
     378    @dbus.service.signal( DBUS_INTERFACE_SMS, "ss" ) 
     379    def IncomingMessageReceipt( self, number, text ): 
     380        logger.info( "incoming message delivery report from %s", number ) 
     381 
    377382    # 
    378383    # dbus org.freesmartphone.GSM.Network 
    379384    # 
  • framework/subsystems/ogsmd/gsm/sms.py

    diff --git a/framework/subsystems/ogsmd/gsm/sms.py b/framework/subsystems/ogsmd/gsm/sms.py
    index 43053b9..58a96a9 100644
    a b class SMS(object): 
    100100        sms = cls( smstype ) 
    101101        offset = 0 
    102102 
    103         if sms.type == "sms-deliver" or sms.type == "sms-submit": 
     103        if sms.type == "sms-deliver" or sms.type == "sms-submit" or sms.type == "sms-status-report": 
    104104            # SCA - Service Center address 
    105105            sca_len = bytes[offset] 
    106106            offset += 1 
    class SMS(object): 
    124124            sms.pdu_mms = sms.pdu_rd 
    125125        elif sms.type == "sms-submit-report": 
    126126            sms.pdu_udhi = pdu_type & 0x04 != 0 
     127        elif sms.type == "sms-status-report": 
     128            sms.pdu_udhi = pdu_type & 0x40 != 0 
     129            sms.pdu_srr = pdu_type & 0x20 != 0 
     130            sms.pdu_mms = pdu_type & 0x04 != 0 
    127131 
    128132        offset += 1 
    129         if sms.type == "sms-submit": 
     133        if sms.type == "sms-submit" or sms.type == "sms-status-report": 
    130134            # MR - Message Reference 
    131135            sms.mr = bytes[offset] 
    132136            offset += 1 
    133137 
    134138        # OA/DA - Originating or Destination Address 
    135139        # WARNING, the length is coded in digits of the number, not in octets occupied! 
    136         if sms.type == "sms-submit" or sms.type == "sms-deliver": 
     140        if sms.type == "sms-submit" or sms.type == "sms-deliver" or sms.type == "sms-status-report": 
    137141            oa_len = 1 + (bytes[offset] + 1) / 2 
    138142            offset += 1 
    139143            sms.oa = PDUAddress.decode( bytes[offset:offset+oa_len] ) 
    140144            sms.da = sms.oa 
    141145 
    142146            offset += oa_len 
     147 
     148            if sms.type == "sms-status-report": 
     149                # Skip SCTS, DT (discharge time), ST, PI FIXME 
     150                offset += 4 
     151 
    143152            # PID - Protocol identifier 
    144153            sms.pid = bytes[offset] 
    145154 
    class SMS(object): 
    185194 
    186195                offset += 7 
    187196 
    188         if sms.type == "sms-submit-report" and not sms.pdu_udli: 
     197        if ( sms.type == "sms-submit-report" and not sms.pdu_udli ) \ 
     198             or sms.type == "sms-status-report": 
     199            # FIXME can sms-status-report have userdata? 
    189200            return sms 
    190201 
    191202        # UD - User Data 
    class SMS(object): 
    198209        self.type = type 
    199210        self.sca = False 
    200211        self.pdu_udhi = False 
    201         self.pdu_srr = False 
     212        self.pdu_srr = True # Request delivery report 
    202213        self.pdu_sri = False 
    203214        self.pdu_rp = False 
    204215        self.pdu_vpf = 0 
  • framework/subsystems/ogsmd/modems/abstract/unsolicited.py

    diff --git a/framework/subsystems/ogsmd/modems/abstract/unsolicited.py b/framework/subsystems/ogsmd/modems/abstract/unsolicited.py
    index 2bd8f6d..715e6f3 100644
    a b class AbstractUnsolicitedResponseDelegate( object ): 
    148148        sms = ogsmd.gsm.sms.SMS.decode( pdu, "sms-deliver" ) 
    149149        self._object.IncomingMessage( str(sms.oa), sms.ud, sms.featureMap ) 
    150150 
     151    # +CDS: <PDU size>\r\n<PDU> 
     152    def plusCDS( self, righthandside, pdu ): 
     153        """ 
     154        Incoming delivery report 
     155        """ 
     156        sms = ogsmd.gsm.sms.SMS.decode( pdu, "sms-status-report" ) 
     157        self._object.IncomingMessageReceipt( str(sms.oa), "delivered" ) 
     158 
    151159    # +CMTI: "SM",7 
    152160    def plusCMTI( self, righthandside ): 
    153161        """