All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] qsimcommand: Add properties and TLV builders to support BIP commands
@ 2011-03-31 15:58 Philippe Nunes
  2011-03-31 19:28 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Nunes @ 2011-03-31 15:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 8998 bytes --]

---
 src/qsimcommand.cpp |  204 +++++++++++++++++++++++++++++++++++++++++++++++++--
 src/qsimcommand.h   |   37 +++++++++
 2 files changed, 235 insertions(+), 6 deletions(-)

diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index ecdf43f..f5dbdf2 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -69,6 +69,8 @@ public:
         timerId = 0;
         device = -1;
         qualifier = 0;
+        bufferSize = 0;
+        dataLength = 0;
     }
     QSimCommandPrivate( QSimCommandPrivate *other )
     {
@@ -102,6 +104,15 @@ public:
         device = other->device;
         qualifier = other->qualifier;
         extensionData = other->extensionData;
+        bearerDesc = other->bearerDesc;
+        bufferSize = other->bufferSize;
+        dataLength = other->dataLength;
+        apn = other->apn;
+        uti = other->uti;
+        userLogin = other->userLogin;
+        userPassword = other->userPassword;
+        destAddress = other->destAddress;
+        localAddress = other->localAddress;
     }
 
     bool flag( int bit ) const
@@ -165,7 +176,15 @@ public:
     int device;
     int qualifier;
     QByteArray extensionData;
-
+    QByteArray bearerDesc;
+    ushort bufferSize;
+    uint dataLength;
+    QByteArray apn;
+    QByteArray uti;
+    QString userLogin;
+    QString userPassword;
+    QByteArray destAddress;
+    QByteArray localAddress;
 };
 
 
@@ -2202,6 +2221,96 @@ void QSimCommand::setTimerId( int id )
     dwrite()->timerId = id;
 }
 
+ushort QSimCommand::bufferSize() const
+{
+    return d->bufferSize;
+}
+
+void QSimCommand::setBufferSize( ushort value )
+{
+    dwrite()->bufferSize = value;
+}
+
+uint QSimCommand::dataLength() const
+{
+    return d->dataLength;
+}
+
+void QSimCommand::setDataLength( uint value )
+{
+    dwrite()->dataLength = value;
+}
+
+QString QSimCommand::userLogin() const
+{
+    return d->userLogin;
+}
+
+void QSimCommand::setUserLogin( const QString& value )
+{
+    dwrite()->userLogin = value;
+}
+
+QString QSimCommand::userPassword() const
+{
+    return d->userPassword;
+}
+
+void QSimCommand::setUserPassword( const QString& value )
+{
+    dwrite()->userPassword = value;
+}
+
+QByteArray QSimCommand::uti() const
+{
+    return d->uti;
+}
+
+void QSimCommand::setUti( const QByteArray& value )
+{
+    dwrite()->uti = value;
+}
+
+QByteArray QSimCommand::bearerDesc() const
+{
+    return d->bearerDesc;
+}
+
+void QSimCommand::setBearerDesc( const QByteArray& value )
+{
+    dwrite()->bearerDesc = value;
+}
+
+QByteArray QSimCommand::localAddress() const
+{
+    return d->localAddress;
+}
+
+void QSimCommand::setLocalAddress( const QByteArray& value )
+{
+    dwrite()->localAddress = value;
+}
+
+QByteArray QSimCommand::destAddress() const
+{
+    return d->destAddress;
+}
+
+void QSimCommand::setDestAddress( const QByteArray& value )
+{
+    dwrite()->destAddress = value;
+}
+
+QByteArray QSimCommand::apn() const
+{
+    return d->apn;
+}
+
+void QSimCommand::setApn( const QByteArray& value )
+{
+    dwrite()->apn = value;
+}
+
 /*!
     Copy the QSimCommand object \a value.
 */
@@ -3045,6 +3154,64 @@ void _qtopiaphone_writeTimerValue( QByteArray& data, uint value )
 }
 #define writeTimerValue _qtopiaphone_writeTimerValue
 
+// Write a Bearer description field.
+static void writeBearerDesc( QByteArray& data, const QByteArray& bearerDesc )
+{
+    if ( !bearerDesc.isEmpty() ) {
+        data += (char)0x35;
+        writeBerLength( data, bearerDesc.length() );
+        data += bearerDesc;
+    }
+}
+
+// Write a Network Access Name field as specified in TS 23.003
+static void writeApn( QByteArray& data, const QByteArray& apn )
+{
+    if ( !apn.isEmpty() ) {
+        data += (char)0x47;
+        writeBerLength( data, apn.length() );
+        data += apn;
+    }
+}
+
+// Write a Buffer size field.
+static void writeBufferSize( QByteArray& data, ushort size )
+{
+    if ( size ) {
+        data += 0x39;
+        data += 0x02;
+        data += (char)(size >> 8);
+        data += (char)size;
+    }
+}
+
+// Write a data length field.
+static void writeDataLength( QByteArray& data, uint value )
+{
+    data += 0x37;
+    data += 0x01;
+    data += (char)value;
+}
+
+// Write a UICC/terminal interface transport level field
+static void writeUti( QByteArray& data, const QByteArray& uti )
+{
+    if ( !uti.isEmpty() ) {
+        data += (char)0x3C;
+        writeBerLength( data, uti.length() );
+        data += uti;
+    }
+}
+
+// Write the Address information field
+static void writeOtherAddress( QByteArray& data, const QByteArray& otherAddress )
+{
+    if ( !otherAddress.isEmpty() ) {
+        data += (char)0x3E;
+        writeBerLength( data, otherAddress.length() );
+        data += otherAddress;
+    }
+}
 /*!
     \enum QSimCommand::ToPduOptions
     This enum defines additional options to use when encoding SIM commands with QSimCommand::toPdu().
@@ -3324,21 +3491,46 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             if ( !text().isEmpty() || ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
                 writeEFADN( data, text(), options, 0x05 );
             writeIcon( data, iconId(), iconSelfExplanatory(), true );
-            if ( !number().isEmpty() )
-                writeEFADNNumber( data, number() );
-            if ( !subAddress().isEmpty() )
-                writeSubAddress( data, subAddress() );
+            writeBearerDesc( data, bearerDesc() );
+            writeBufferSize( data, bufferSize() );
+            writeApn( data, apn() );
+            writeOtherAddress( data, localAddress() );
+            if ( !userLogin().isEmpty() )
+                writeTextString( data, userLogin(), QSimCommand::NoPduOptions, 0x0D );
+            if ( !userPassword().isEmpty() )
+                writeTextString( data, userPassword(), QSimCommand::NoPduOptions, 0x0D );
+            writeUti( data, uti() );
+            writeOtherAddress( data, destAddress() );
             writeTextAttribute( data, textAttribute() );
         }
         break;
 
-        case CloseChannel:
         case ReceiveData:
+        {
+            if ( !text().isEmpty() || ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
+                writeEFADN( data, text(), options, 0x05 );
+            writeIcon( data, iconId(), iconSelfExplanatory(), true );
+            writeDataLength( data, dataLength() );
+            writeTextAttribute( data, textAttribute() );
+        }
+        break;
+
         case SendData:
         {
             if ( !text().isEmpty() || ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
                 writeEFADN( data, text(), options, 0x05 );
             writeIcon( data, iconId(), iconSelfExplanatory(), true );
+            data += extData;
+            writeTextAttribute( data, textAttribute() );
+        }
+        break;
+
+        case CloseChannel:
+        case GetChannelStatus:
+        {
+            if ( !text().isEmpty() || ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
+                writeEFADN( data, text(), options, 0x05 );
+            writeIcon( data, iconId(), iconSelfExplanatory(), true );
             writeTextAttribute( data, textAttribute() );
         }
         break;
diff --git a/src/qsimcommand.h b/src/qsimcommand.h
index eadd768..ea7f17a 100644
--- a/src/qsimcommand.h
+++ b/src/qsimcommand.h
@@ -215,6 +215,16 @@ public:
         Network             = 0x83
     };
 
+    enum OpenChannelQualifier {
+	    OpenchannelOnDemand	 = 0x00,
+	    OpenchannelImmediate = 0x01,
+    };
+
+    enum SendDataQualifier {
+	    SendDataStoreData	= 0x00,
+	    SendDataImmediately	= 0x01,
+    };
+
     int commandNumber() const;
     void setCommandNumber( int value );
 
@@ -362,6 +372,33 @@ public:
     int qualifier() const;
     void setQualifier( int value );
 
+    QByteArray bearerDesc() const;
+    void setBearerDesc( const QByteArray& value );
+
+    ushort bufferSize() const;
+    void setBufferSize( ushort value );
+
+    uint dataLength() const;
+    void setDataLength( uint value );
+
+    QByteArray apn() const;
+    void setApn( const QByteArray& value );
+
+    QByteArray destAddress() const;
+    void setDestAddress( const QByteArray& value );
+
+    QByteArray localAddress() const;
+    void setLocalAddress( const QByteArray& value );
+
+    QString userLogin() const;
+    void setUserLogin( const QString& value );
+
+    QString userPassword() const;
+     void setUserPassword( const QString& value );
+
+    QByteArray uti() const;
+    void setUti( const QByteArray& value );
+
     QByteArray extensionData() const;
     void setExtensionData( QByteArray value );
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/2] qsimcommand: Add properties and TLV builders to support BIP commands
  2011-03-31 15:58 [PATCH v2 1/2] qsimcommand: Add properties and TLV builders to support BIP commands Philippe Nunes
@ 2011-03-31 19:28 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-03-31 19:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

Hi Philippe,

On 03/31/2011 10:58 AM, Philippe Nunes wrote:
> ---
>  src/qsimcommand.cpp |  204 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  src/qsimcommand.h   |   37 +++++++++
>  2 files changed, 235 insertions(+), 6 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-31 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 15:58 [PATCH v2 1/2] qsimcommand: Add properties and TLV builders to support BIP commands Philippe Nunes
2011-03-31 19:28 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.