Gsmd/zh tw

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(State tracking)
(狀態追蹤)
Line 200: Line 200:
 
gsmd 需要在GSM硬體上進行適當的狀態追蹤。 針對很多傳送狀態,我們只能從GSM數據機上取得事件,但並沒有適合的詢問指令。不然,假設 gsmd 持續的執行,應用程式可以執行,但仍有與目前數據機狀態的想法,即使他們遺失了啟始的狀態傳送。
 
gsmd 需要在GSM硬體上進行適當的狀態追蹤。 針對很多傳送狀態,我們只能從GSM數據機上取得事件,但並沒有適合的詢問指令。不然,假設 gsmd 持續的執行,應用程式可以執行,但仍有與目前數據機狀態的想法,即使他們遺失了啟始的狀態傳送。
  
Also, gsmd state tracking allows us to allow for safer interoperability of multiple applications.  If i.e. one applications has just started an outgoing call, gsmd can detect another application who intends to interfere with that and deny access
+
同時,gsmd 狀態追蹤允許我們能安全的操作多個應用程式。如一個應用程式被"發話"所啟始,gsmd可以偵測其它的想要干預它並拒絕存取的應用程式。
  
=== device power state ===
 
  
* modem completely off, not responding to AT commands
+
=== 裝置電源狀態 ===
* modem responding to AT commands, but powered off (CFUN=0)
+
* modem responding to AT commands, in some power saving mode
+
* modem responding to AT commands, powered on, fully operational (CFUN=1)
+
  
=== Suspend power state ===
+
* 數據機完全的關閉,不回應任何AT指令
 +
* 數據機回應AT指令,但未啟動電源(CFUN=0)
 +
* 數據機回應AT指令,在省電模式下
 +
* 數據機回應AT指令,啟動電源,並完全可被操控 (CFUN=1)
  
It must also configure the modem so that it can on appropriate events wake the system from sleep.
+
=== 中斷電源模式 ===
  
=== network registration state ===
+
它必須由數據機設定,以便於它可以由適當的事件,讓系統從睡眠模式下被喚醒。
  
* not registered to any network, not trying to register
+
=== 網路登錄狀態 ===
* not registred to any network, searching/trying to register
+
* registered to home network (including cellID)
+
* registered to roaming network (including cellID)
+
  
=== ciphering indication state ===
+
* 未登錄到入何網路,並且未嚐試進行登錄動作
 +
* 未登錄到任何網路,搜尋/嚐試登錄
 +
* 登錄到家庭網路(包括 cellID)
 +
* 登錄漫遊網路 (包含cellID)
  
* ciphering indications not supported by modem
+
=== 加密指示狀態 ===
* ciphering indications supported, but disabled in SIM
+
* ciphering indications supported, ciphering active
+
* ciphering indications supported, ciphering inactive
+
  
=== call state ===
+
* 數據機不支援加密指示器
 +
* 支援加密指示,但SIM不支援加密指示
 +
* 支援加密指示,加密作用中
 +
* 支援加密指示,加密未作用
 +
=== 通話狀態 ===
  
* idle
+
* 無法接聽
* busy
+
* 忙線
  
Sources of gsmd are kept in [[OpenMoko svn]] in src/target/gsm directory.
+
gsmd source被放置在src/target/gsm 目錄下的[[OpenMoko svn]]
  
 
{{Languages | Gsmd}}
 
{{Languages | Gsmd}}

Revision as of 10:47, 19 May 2008

gsmd 是在Openmoko手機上執行的 GSM背景程式。它用來管理話機中傳統的'通話' 領域 (聲音/簡訊/gprs 通訊連結)。

你可以在這裡找到進行中的進階技術描述及API文件。


Contents

Usage

On the phone

當以/etc/init.d/gsmd script啟動時,gsmd 通常會以背景程式執行,在這個案例當中gsmd會輸出偵錯訊息到 "/tmp/gsm.log"檔案中 (stdout及stderr在這裡則被重新導引).

針對偵錯目地,gsmd可以在前景模式下執行,可以被使用的選項如下:

> gsmd --help
gsmd - (C) 2006 by Harald Welte <laforge@gnumonks.org>
This program is FREE SOFTWARE under the terms of GNU GPL

Usage:
        -v      --version       顯示程式版本
        -d      --daemon        Deamonize
        -h      --help          顯示輔助訊息
        -p dev  --device dev    指定串列裝置為作用中裝置
        -s spd  --speed spd     指定bps速度 (9600,38400,115200,...)
        -F      --hwflow        硬體流量控制(RTS/CTS)
        -L      --leak-report   Leak Report of talloc memory allocator
        -l file --logfile file  Specify a logfile to log to

如果你的GSM 數據機連接到ttySAC0 (如 Neo1973), 使用如下指令啟動它:

> gsmd -p /dev/ttySAC0 -s 115200 -F

(baud rate可被modem自動偵測)

從host PC

使用最近的 uboot (svn > r2885),gsm modem可以電源啟動,並且從uboot本身連接到uboot的串列控制埠。然後,允許host PC直接與數據機互動。關於host pc執行gsmd 的文章,你可以在這裡找到。

libgsmd

libgsmd 是C 語言API中的程式庫。這個程式庫的程式可以被用在手機上,如打電話、接收電話、註冊為網路一員...等。

libgsmd-tool

libgsmd-tool 是可以用來詮釋libgsmd API的小型展示應用程式。

Usage

libgsmd-tool 有多重模式。

Usage of shell mode

Shell 模式針對語音通話提供一個簡單的text-based 指令界面。

shell 模式可以利用下面的指令啟動

libgsmd-tool -m shell

以下即為它的實做範例:

> src/util/libgsmd-tool -m shell
libgsm-tool - (C) 2006 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

?
        A       Answer incoming call
        D       Dial outgoing number
        H       Hangup call
        O       Power On
        o       Power Off
        r       Register to network
        R       Register to given operator (R=number)
        U       Unregister from netowrk
        P       Print current operator
        L       Detect available operators
        Q       Read signal quality
        T       Send DTMF Tone
        n       Print subscriber numbers
        pd      PB Delete (pb=index)
        pr      PB Read (pr=index)
        prr     PB Read Range (prr=index1,index2)
        pf      PB Find (pf=indtext)
        pw      PB Write (pw=index,number,text)
        ps      PB Support
        pm      PB Memory
        pp      PB Set Memory (pp=storage)
        pRr     Retrieve Readrg Records
        pRf     Retrieve Find Records
        sd      SMS Delete (sd=index,delflg)
        sl      SMS List (sl=stat)
        sr      SMS Read (sr=index)
        ss      SMS Send (ss=ask_ds,number,text|["text"])
        sw      SMS Write (sw=stat,number,text)
        sm      SMS Storage stats
        sM      SMS Set preferred storage (sM=mem1,mem2,mem3)
        sc      SMS Show Service Centre
        sC      SMS Set Service Centre (sC=number)
        q       Quit

O
# EVENT: PIN request (type=1) Please enter PIN: 6582
r
# EVENT: Netreg searching for network 
EVENT: Netreg registered (home network) 

D03024033902
# Dial 03024033902
EVENT: Call Progress: UNKNOWN
EVENT: Call Progress: PROCEED
EVENT: Call Progress: SYNC
EVENT: Call Progress: ALERT
H
# Hangup
EVENT: Call Progress: DISCONNECT
EVENT: Call Progress: RELEASE

EVENT: Incoming call type=2!
EVENT: Incoming call clip=`"03024033902"'
EVENT: Incoming call type=2!
A
# Answer
RSTR=`OK'
H
# Hangup
RSTR=`OK'

atcmd 模式的用途mode

atcmd模式是passthrough-mode。Passthrough指的是它接收 GSM 07.07 指令,透過背景程式將它傳送到電話,並且傳回你的回應。這對於偵除錯誤來講,是很有用的一個方法。


atcmd模式可以由使用下列指令來啟用它

libgsmd-tool -m atcmd

它的用途可以參考下面的範例:

> src/util/libgsmd-tool -m atcmd
libgsm-tool - (C) 2006 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

AT+CPAS
STR=`AT+CPAS'
RSTR=`+CPAS: 0'
AT+COPS=?
STR=`AT+COPS=?'
RSTR=`+COPS: (2,"E-Plus","E-Plus","26203"),(3,"o2 - de","o2 - de","26207"),(3,"Vodafone.de","Vodafone","26202"),(3,"T-Mobile D","TMO D","26201")'

網路相關的功能

控制員的選擇功能被合併到 SVN head[1]

libgsmd-util 指令列如下:

 R  -  Register to given operator (R=number)
 P  -  Print current operator
 L  -  Detect available operators
 Q  -  Read signal quality

它是由名為 "_opers_" 所執行。

目前所欠缺的

(如果你遺失了某些功能,請將這些項目加下以下的清單)

  • 話機相關功能
    • 飛航模式/gsmd 暫停 (它將會在gsmd外被執行,透過使用runlevels / upstart)
    • 設定緊急呼叫,即使裝置沒有安裝SIM卡
    • 取得製造商/型號/修訂版/IMEI
    • 能通知使用者SIM卡未被鎖住的功能 (或者能自動的反鎖它)
  • 簡訊相關的功能
    • 傳送簡訊
    • 接收簡訊
    • 取得IMSI
    • 存取SIM卡,儲存簡訊到SIM卡 - 不再有遺失的狀況 - 參考輔助說明
  • SIM 相關功能
    • 讀取電話簿輸入 - 不再有遺失的狀況 - 參考輔助說明
    • 寫入電話簿 - 不再有遺失的狀況 - 參考輔助說明
  • GPRS相關功能
    • 設定GPRS連結,透過分散的TS07.10使用DLC of TS07.10 多路傳輸
  • gsmd內部基礎架設
    • fine-grained event subscriptions (rather than wildcard-subscribe)
    • 從指令列上指定log-level 的可能性
    • 在SIGUSR1或SIGHUP重新開啟日誌檔 (logrotate)
    • 權限處理
    • d-bus 界面

Implementation Thoughts

測試架構

模擬韌體、gsmd及libgsmd 可以在任何機器上被良好的測試。 參考 Kero's page或者直接參考 (lib)gsmd 測試頁.

狀態追蹤

gsmd 需要在GSM硬體上進行適當的狀態追蹤。 針對很多傳送狀態,我們只能從GSM數據機上取得事件,但並沒有適合的詢問指令。不然,假設 gsmd 持續的執行,應用程式可以執行,但仍有與目前數據機狀態的想法,即使他們遺失了啟始的狀態傳送。

同時,gsmd 狀態追蹤允許我們能安全的操作多個應用程式。如一個應用程式被"發話"所啟始,gsmd可以偵測其它的想要干預它並拒絕存取的應用程式。


裝置電源狀態

  • 數據機完全的關閉,不回應任何AT指令
  • 數據機回應AT指令,但未啟動電源(CFUN=0)
  • 數據機回應AT指令,在省電模式下
  • 數據機回應AT指令,啟動電源,並完全可被操控 (CFUN=1)

中斷電源模式

它必須由數據機設定,以便於它可以由適當的事件,讓系統從睡眠模式下被喚醒。

網路登錄狀態

  • 未登錄到入何網路,並且未嚐試進行登錄動作
  • 未登錄到任何網路,搜尋/嚐試登錄
  • 登錄到家庭網路(包括 cellID)
  • 登錄漫遊網路 (包含cellID)

加密指示狀態

  • 數據機不支援加密指示器
  • 支援加密指示,但SIM不支援加密指示
  • 支援加密指示,加密作用中
  • 支援加密指示,加密未作用

通話狀態

  • 無法接聽
  • 忙線

gsmd source被放置在src/target/gsm 目錄下的OpenMoko svn

Personal tools

gsmd 是在Openmoko手機上執行的 GSM背景程式。它用來管理話機中傳統的'通話' 領域 (聲音/簡訊/gprs 通訊連結)。

你可以在這裡找到進行中的進階技術描述及API文件。


Usage

On the phone

當以/etc/init.d/gsmd script啟動時,gsmd 通常會以背景程式執行,在這個案例當中gsmd會輸出偵錯訊息到 "/tmp/gsm.log"檔案中 (stdout及stderr在這裡則被重新導引).

針對偵錯目地,gsmd可以在前景模式下執行,可以被使用的選項如下:

> gsmd --help
gsmd - (C) 2006 by Harald Welte <laforge@gnumonks.org>
This program is FREE SOFTWARE under the terms of GNU GPL

Usage:
        -v      --version       顯示程式版本
        -d      --daemon        Deamonize
        -h      --help          顯示輔助訊息
        -p dev  --device dev    指定串列裝置為作用中裝置
        -s spd  --speed spd     指定bps速度 (9600,38400,115200,...)
        -F      --hwflow        硬體流量控制(RTS/CTS)
        -L      --leak-report   Leak Report of talloc memory allocator
        -l file --logfile file  Specify a logfile to log to

如果你的GSM 數據機連接到ttySAC0 (如 Neo1973), 使用如下指令啟動它:

> gsmd -p /dev/ttySAC0 -s 115200 -F

(baud rate可被modem自動偵測)

從host PC

使用最近的 uboot (svn > r2885),gsm modem可以電源啟動,並且從uboot本身連接到uboot的串列控制埠。然後,允許host PC直接與數據機互動。關於host pc執行gsmd 的文章,你可以在這裡找到。

libgsmd

libgsmd 是C 語言API中的程式庫。這個程式庫的程式可以被用在手機上,如打電話、接收電話、註冊為網路一員...等。

libgsmd-tool

libgsmd-tool 是可以用來詮釋libgsmd API的小型展示應用程式。

Usage

libgsmd-tool 有多重模式。

Usage of shell mode

Shell 模式針對語音通話提供一個簡單的text-based 指令界面。

shell 模式可以利用下面的指令啟動

libgsmd-tool -m shell

以下即為它的實做範例:

> src/util/libgsmd-tool -m shell
libgsm-tool - (C) 2006 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

?
        A       Answer incoming call
        D       Dial outgoing number
        H       Hangup call
        O       Power On
        o       Power Off
        r       Register to network
        R       Register to given operator (R=number)
        U       Unregister from netowrk
        P       Print current operator
        L       Detect available operators
        Q       Read signal quality
        T       Send DTMF Tone
        n       Print subscriber numbers
        pd      PB Delete (pb=index)
        pr      PB Read (pr=index)
        prr     PB Read Range (prr=index1,index2)
        pf      PB Find (pf=indtext)
        pw      PB Write (pw=index,number,text)
        ps      PB Support
        pm      PB Memory
        pp      PB Set Memory (pp=storage)
        pRr     Retrieve Readrg Records
        pRf     Retrieve Find Records
        sd      SMS Delete (sd=index,delflg)
        sl      SMS List (sl=stat)
        sr      SMS Read (sr=index)
        ss      SMS Send (ss=ask_ds,number,text|["text"])
        sw      SMS Write (sw=stat,number,text)
        sm      SMS Storage stats
        sM      SMS Set preferred storage (sM=mem1,mem2,mem3)
        sc      SMS Show Service Centre
        sC      SMS Set Service Centre (sC=number)
        q       Quit

O
# EVENT: PIN request (type=1) Please enter PIN: 6582
r
# EVENT: Netreg searching for network 
EVENT: Netreg registered (home network) 

D03024033902
# Dial 03024033902
EVENT: Call Progress: UNKNOWN
EVENT: Call Progress: PROCEED
EVENT: Call Progress: SYNC
EVENT: Call Progress: ALERT
H
# Hangup
EVENT: Call Progress: DISCONNECT
EVENT: Call Progress: RELEASE

EVENT: Incoming call type=2!
EVENT: Incoming call clip=`"03024033902"'
EVENT: Incoming call type=2!
A
# Answer
RSTR=`OK'
H
# Hangup
RSTR=`OK'

atcmd 模式的用途mode

atcmd模式是passthrough-mode。Passthrough指的是它接收 GSM 07.07 指令,透過背景程式將它傳送到電話,並且傳回你的回應。這對於偵除錯誤來講,是很有用的一個方法。


atcmd模式可以由使用下列指令來啟用它

libgsmd-tool -m atcmd

它的用途可以參考下面的範例:

> src/util/libgsmd-tool -m atcmd
libgsm-tool - (C) 2006 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

AT+CPAS
STR=`AT+CPAS'
RSTR=`+CPAS: 0'
AT+COPS=?
STR=`AT+COPS=?'
RSTR=`+COPS: (2,"E-Plus","E-Plus","26203"),(3,"o2 - de","o2 - de","26207"),(3,"Vodafone.de","Vodafone","26202"),(3,"T-Mobile D","TMO D","26201")'

網路相關的功能

控制員的選擇功能被合併到 SVN head[1]

libgsmd-util 指令列如下:

 R  -  Register to given operator (R=number)
 P  -  Print current operator
 L  -  Detect available operators
 Q  -  Read signal quality

它是由名為 "_opers_" 所執行。

目前所欠缺的

(如果你遺失了某些功能,請將這些項目加下以下的清單)

  • 話機相關功能
    • 飛航模式/gsmd 暫停 (它將會在gsmd外被執行,透過使用runlevels / upstart)
    • 設定緊急呼叫,即使裝置沒有安裝SIM卡
    • 取得製造商/型號/修訂版/IMEI
    • 能通知使用者SIM卡未被鎖住的功能 (或者能自動的反鎖它)
  • 簡訊相關的功能
    • 傳送簡訊
    • 接收簡訊
    • 取得IMSI
    • 存取SIM卡,儲存簡訊到SIM卡 - 不再有遺失的狀況 - 參考輔助說明
  • SIM 相關功能
    • 讀取電話簿輸入 - 不再有遺失的狀況 - 參考輔助說明
    • 寫入電話簿 - 不再有遺失的狀況 - 參考輔助說明
  • GPRS相關功能
    • 設定GPRS連結,透過分散的TS07.10使用DLC of TS07.10 多路傳輸
  • gsmd內部基礎架設
    • fine-grained event subscriptions (rather than wildcard-subscribe)
    • 從指令列上指定log-level 的可能性
    • 在SIGUSR1或SIGHUP重新開啟日誌檔 (logrotate)
    • 權限處理
    • d-bus 界面

Implementation Thoughts

測試架構

模擬韌體、gsmd及libgsmd 可以在任何機器上被良好的測試。 參考 Kero's page或者直接參考 (lib)gsmd 測試頁.

狀態追蹤

gsmd 需要在GSM硬體上進行適當的狀態追蹤。 針對很多傳送狀態,我們只能從GSM數據機上取得事件,但並沒有適合的詢問指令。不然,假設 gsmd 持續的執行,應用程式可以執行,但仍有與目前數據機狀態的想法,即使他們遺失了啟始的狀態傳送。

Also, gsmd state tracking allows us to allow for safer interoperability of multiple applications. If i.e. one applications has just started an outgoing call, gsmd can detect another application who intends to interfere with that and deny access

device power state

  • modem completely off, not responding to AT commands
  • modem responding to AT commands, but powered off (CFUN=0)
  • modem responding to AT commands, in some power saving mode
  • modem responding to AT commands, powered on, fully operational (CFUN=1)

Suspend power state

It must also configure the modem so that it can on appropriate events wake the system from sleep.

network registration state

  • not registered to any network, not trying to register
  • not registred to any network, searching/trying to register
  • registered to home network (including cellID)
  • registered to roaming network (including cellID)

ciphering indication state

  • ciphering indications not supported by modem
  • ciphering indications supported, but disabled in SIM
  • ciphering indications supported, ciphering active
  • ciphering indications supported, ciphering inactive

call state

  • idle
  • busy

Sources of gsmd are kept in OpenMoko svn in src/target/gsm directory.