GSM Modem Integration

来源:互联网 发布:java 封装变化 编辑:程序博客网 时间:2024/05/21 11:13

有一个产品使用QT Extended 4.4.3 现将要移植的一些内容记录如下:

 

还是要写自己的device profile

 

项目使用的模块为Enfora

现在的Modem都支持3GPP TS 27.007 和 3GPP TS 27.005,但各个厂商自己扩展了一些AT命令集.

Qt Extended 通过插件的机制支持厂商指定的modem命令。厂商相关的代码放在 devices/DEVNAME/src/plugins/phonevendors/DEVNAME, 目录下。

 

Qt Extended 通过custom.h中QTOPIA_PHONE_VENDOR宏指定的信息加载特定厂商的插件(例如设置QTOPIA_PHONE_VENDOR=wavecom 将加载libwavecomvendor.so).

 

3GPP TS 07.10 复用模式通过 QTOPIA_PHONE_MUX 环境变量设置(no). 用户需要编写复用模式的插件(复用模式分为basic和advance两种)

 

Modem插件的框架

有两个示例位于

src/plugins/phonevendors/ericsson

src/plugins/phonevendors/wavecom.

插件继承自 QModemServicePlugin 类, 提供modem监测和创建功能.

    #include <qmodemserviceplugin.h>    class WavecomPluginImpl : public QModemServicePlugin    {        Q_OBJECT    public:        WavecomPluginImpl();        virtual ~WavecomPluginImpl();        bool supports( const QString& manufacturer );        QModemService *create( const QString& service,                               QSerialIODeviceMultiplexer *mux,                               QObject *parent );    };

插件提供两个函数 supports() 和create(),代码实现如下:

    QTOPIA_EXPORT_PLUGIN( WavecomPluginImpl )    WavecomPluginImpl::WavecomPluginImpl() {}    WavecomPluginImpl::~WavecomPluginImpl() {}    bool WavecomPluginImpl::supports( const QString& manufacturer )    {        return manufacturer.contains( "WAVECOM" );    }    QModemService *WavecomPluginImpl::create        ( const QString& service, QSerialIODeviceMultiplexer *mux, QObject *parent )    {        return new WavecomModemService( service, mux, parent );    }

supports()函数监测厂商字符串。

在Enfora开发板上发送AT+CGMI

返回:.

 

create() 函数创建一个 QModemService 实例处理modem.传递三个参数

service 名(通常为 modem)

mux 复用对象 ,用以同modem通讯

parent 父QObject 对象

 

 QModemService 重载 initialize() 创建厂商指定代码:

    #include <qmodemservice.h>    class WavecomModemService : public QModemService    {        Q_OBJECT    public:        WavecomModemService            ( const QString& service, QSerialIODeviceMultiplexer *mux,              QObject *parent = 0 );        ~WavecomModemService();        void initialize();        ...    };    WavecomModemService::WavecomModemService            ( const QString& service, QSerialIODeviceMultiplexer *mux,              QObject *parent )        : QModemService( service, mux, parent )    {        ...    }    WavecomModemService::~WavecomModemService() {}    void WavecomModemService::initialize()    {        // Create our Wavecom-specific overrides for the service interfaces.        if ( !supports<QSimInfo>() )            addInterface( new WavecomSimInfo( this ) );        if ( !supports<QSimToolkit>() )            addInterface( new WavecomSimToolkit( this ) );        if ( !supports<QPhoneBook>() )            addInterface( new WavecomPhoneBook( this ) );        if ( !supports<QPhoneRfFunctionality>() )            addInterface( new WavecomRfFunctionality( this ) );        if ( !supports<QTelephonyConfiguration>() )            addInterface( new WavecomConfiguration( this ) );        if ( !callProvider() )            setCallProvider( new WavecomCallProvider( this ) );        // Call QModemService to create other interfaces that we didn't override.        QModemService::initialize();    }

Qt Extended的Modem services分成几个接口。每个代表一定的功能块 (phone calls, network registration, SMS, SIM toolkit, phone books 等).

主要是实现 3GPP TS 27.007 and 3GPP TS 27.005 协议。 The modem vendor plug-in overrides those handlers that are different from the standard, and only those that are different. When QModemService::initialize() is called, the missing handlers will be created automatically.

The handlers mentioned above inherit from the following standard classes:

WavecomSimInfoQModemSimInfoWavecomSimToolkitQModemSimToolkitWavecomPhoneBookQModemPhoneBookWavecomRfFunctionalityQModemRfFunctionalityWavecomConfigurationQModemConfigurationWavecomCallProviderQModemCallProvider

A complete list of classes for accessing AT-based modems can be found on the Modem Classes page.

Modem Porting Sequence

To support a modem the following sequence may be used as a guide:

  1. Check the AT Commands that Qt Extended requires and determine which ones your modem supports.
  2. Determine the appropriate alternative AT commands suited to your modem and write the vendor-specific plug-in to issue these commands.
  3. Run Qt Extended with the QTOPIA_PHONE_MUX environment variable set to no and with the AtChat and Modem logging categories enabled.
  4. Check the error/message log for commands that are reported as being in error.
  5. Using the error log, modify the plug-in and/or the phone library so that the modem-supported AT command parameters are used.
  6. Repeat from the second step until phone calls are possible and SIM details are being read.
  7. Write a multiplexer plug-in if your modem does not support 3GPP TS 07.10, or the 07.10 parameters need to be adjusted.
  8. Enable multiplexing by setting the QTOPIA_PHONE_MUX environment variable to yes.
  9. Re-test Qt Extended, especially the GPRS features, until the multiplexer is functioning correctly. Verbose multiplexer debugging can be enabled with the Mux logging category.
原创粉丝点击