顯示具有 Wireless 標籤的文章。 顯示所有文章
顯示具有 Wireless 標籤的文章。 顯示所有文章

2011年11月16日 星期三

[Android] Bluetooth - (3) APIs

Minim Android API Level Suggestion: Android 2.0 (Level 5)


Provided from API 5: Basic Functions



Provided from API 11: Working with Profiles

  • BluetoothProfile
    • A Bluetooth profile is a wireless interface specification for Bluetooth-based communication between devices.
  • BluetoothProfile.ServiceListener
    • The internal service that runs a particular profile
  • BluetoothA2dp
    • A2dp: Advanced Audio Distribution Profile
    • Defines how high quality audio can be streamed from one device to another over a Bluetooth connection.
    • To control the Bluetooth A2DP profile.
    • Only supports one connected Bluetooth A2dp device at a time.
  • BluetoothAssignedNumbers
    • Only include Company ID values.
    • Company Identifiers
  • BluetoothHeadset
    • Provides support for Bluetooth headsets to be used with mobile phones.
    • Controlling the Bluetooth Headset(Handsfree v1.5) Service.
    • Only supports one connected Bluetooth Headset at a time.


Provided from API 14: Bluetooth Health Devices

  • 提供使用藍芽進行健康照護,透過藍芽與監視裝置連線
  • BluetoothHealth
    • A proxy object for controlling the Bluetooth Service via IPC.BluetoothHealthCallback
    • 接收所監視的資訊與藍芽狀態。
  • BluetoothHealthAppConfiguration
    • 會從 BluetoothHealthCallback 得到此物件,其中關於連線設備的設定資訊。
    • ex: 可由 configuration 資訊來 initiate and terminate connections。



* Reference
- Bluetooth | Android Developers
- Bluetooth Glossary

2011年11月14日 星期一

[Android] Bluetooth - (2) Connection

Connecting as a server
  • Server is holding an open BluetoothServerSocket.
  • The purpose of the server socket is to listen for incoming connection requests and when one is accepted, provide a connected BluetoothSocket.
  • When the BluetoothSocket is acquired from the BluetoothServerSocket, the BluetoothServerSocket can (and should) be discarded, unless you want to accept more connections.


Here's the basic procedure to set up a server socket and accept a connection:

1. Get a BluetoothServerSocket by calling thelistenUsingRfcommWithServiceRecord(String, UUID).
  • The string is an identifiable name of your service.
  • The system will automatically write to a new Service Discovery Protocol (SDP) database entry on the device (the name is arbitrary and can simply be your application name).
  • The UUID is also included in the SDP entry and will be the basis for the connection agreement with the client device.
    • When the client attempts to connect with this device, it will carry a UUID that uniquely identifies the service with which it wants to connect. 
    • These UUIDs must match in order for the connection to be accepted (in the next step).

2. Start listening for connection requests by calling accept().
  • This is a blocking call. 
    • The accept() call should not be executed in the main Activity UI thread because it is a blocking call and will prevent any other interaction with the application.
    • To abort a blocked call such as accept(), call close() on the BluetoothServerSocket (or BluetoothSocket) from another thread and the blocked call will immediately return. 
  • It will return when either a connection has been accepted or an exception has occurred. 
  • A connection is accepted only when a remote device has sent a connection request with a UUID matching the one registered with this listening server socket.
  • When successful, accept() will return a connected BluetoothSocket.

3. Unless you want to accept additional connections, call close().
  • This releases the server socket and all its resources, but does not close the connected BluetoothSocket that's been returned by accept(). 
  • Unlike TCP/IP, RFCOMM only allows one connected client per channel at a time, so in most cases it makes sense to call close() on the BluetoothServerSocket immediately after accepting a connected socket.
Note:
  • All methods on a BluetoothServerSocket or BluetoothSocket are thread-safe.
    • It usually makes sense to do all work with a BluetoothServerSocket or BluetoothSocket in a new thread managed by your application.
  • When accept() returns the BluetoothSocket, the socket is already connected, so you should not call connect() (as you do from the client-side).



Connecting as a client
  • In order to initiate a connection with a remote device, you must first obtain a BluetoothDevice object that represents the remote device.
  • You must then use the BluetoothDevice to acquire a BluetoothSocket and initiate the connection.

Here's the basic procedure:

1. Using the BluetoothDevice, get a BluetoothSocket by calling createRfcommSocketToServiceRecord(UUID).
  • This initializes a BluetoothSocket that will connect to the BluetoothDevice. 
  • The UUID passed here must match the UUID used by the server device when it opened its BluetoothServerSocket (with listenUsingRfcommWithServiceRecord(String, UUID)).
  • Using the same UUID is simply a matter of hard-coding the UUID string into your application and then referencing it from both the server and client code.


2. Initiate the connection by calling connect().
  • This method is a blocking call. 
    • If, for any reason, the connection fails or the connect() method times out (after about 12 seconds), then it will throw an exception.
    • This connection procedure should always be performed in a thread separate from the main Activity thread.
  • Upon this call, the system will perform an SDP lookup on the remote device in order to match the UUID. 
    • If the lookup is successful and the remote device accepts the connection, it will share the RFCOMM channel to use during the connection and connect() will return. 
Note: 
  • Ensure that the device is not performing device discovery when you call connect().
    • If discovery is in progress, then the connection attempt will be significantly slowed and is more likely to fail.
  • cancelDiscovery() is called before the connection is made.
    • You should always do this before connecting and it is safe to call without actually checking whether it is running or not (but if you do want to check, call isDiscovering()).


Managing a Connection

Using the BluetoothSocket, the general procedure to transfer arbitrary data is simple:
  1. Get the InputStream and OutputStream that handle transmissions through the socket, via getInputStream() and getOutputStream(), respectively.
  2. Read and write data to the streams with read(byte[]) and write(byte[]).
Note
  • Should use a dedicated thread for all stream reading and writing.
    • This is important because both read(byte[]) and write(byte[]) methods are blocking calls.



Working with Profiles
Starting in Android 3.0, the Bluetooth API includes support for working with Bluetooth profiles.

A Bluetooth profile
  • Is a wireless interface specification for Bluetooth-based communication between devices. 
  • An example is the Hands-Free profile. For a mobile phone to connect to a wireless headset, both devices must support the Hands-Free profile.

Support Profiles
  • Headset
    • The Headset profile provides support for Bluetooth headsets to be used with mobile phones.
    • BluetoothHeadset class
      • A proxy for controlling the Bluetooth Headset Service via interprocess communication (IPC). 
      • Includes both Bluetooth Headset and Hands-Free (v1.5) profiles.
      • Support for AT commands. For more discussion of this topic, see Vendor-specific AT commands
  • A2DP
    • The Advanced Audio Distribution Profile (A2DP).
    • Defines how high quality audio can be streamed from one device to another over a Bluetooth connection.
    • BluetoothA2dp class
      • A proxy for controlling the Bluetooth A2DP Service via IPC.


Here are the basic steps for working with a profile:
  1. Get the default adapter, as described in Setting Up Bluetooth.
  2. Use getProfileProxy() to establish a connection to the profile proxy object associated with the profile. In the example below, the profile proxy object is an instance of BluetoothHeadset.
  3. Set up a BluetoothProfile.ServiceListener. This listener notifies BluetoothProfile IPC clients when they have been connected to or disconnected from the service.
  4. In onServiceConnected(), get a handle to the profile proxy object.
  5. Once you have the profile proxy object, you can use it to monitor the state of the connection and perform other operations that are relevant to that profile.



By the way

UUID
  • Universally Unique Identifier (UUID) 
  • A standardized 128-bit format for a string ID used to uniquely identify information. 
  • Big enough that you can select any random and it won't clash.
  • Used to uniquely identify your application's Bluetooth service.
  • To get a UUID to use with your application, you can use one of the many random UUID generators on the web, then initialize a UUID with fromString(String).



* Reference
- Bluetooth | Android Developers **
- package android.bluetooth
- Android應用程式學習筆記 - Bluetooth
- 藍牙規範 - 维基百科,自由的百科全书
- Bluetooth profile - Wikipedia, the free encyclopedia
- Android 上的 Bluetooth | 憑虛御風
- Bluetooth Health Devices

[Android] Bluetooth - (1)

Using the Bluetooth APIs, an Android application can perform the following:
  • Scan for other Bluetooth devices
  • Query the local Bluetooth adapter for paired Bluetooth devices
  • Establish RFCOMM channels
  • Connect to other devices through service discovery
  • Transfer data to and from other devices
  • Manage multiple connections

Four steps to communicate using Bluetooth
  1. Setting up Bluetooth
  2. Finding devices that are either paired or available in the local area
  3. Connecting devices
  4. Transferring data between devices.

Permissions
  • BLUETOOTH
    • To perform any Bluetooth communication
    • 讓程式有權限連接裝置、傳輸資料。
      • ex: requesting a connection, accepting a connection, and transferring data.
  • BLUETOOTH_ADMIN
    • Initiate device discovery or manipulate Bluetooth settings.
    • 讓程式有權限搜尋裝置及設定藍芽。
  • Note
    • If you use BLUETOOTH_ADMIN permission, then must also have the BLUETOOTH permission.


Check Bluetooth Function

在使用 Bluetooth 前必須先確認裝置有支援並且已開啟。判斷的方式如下:

1. Get the BluetoothAdapter
  • This returns a BluetoothAdapter that represents the device's own Bluetooth adapter (the Bluetooth radio).
    • There's one Bluetooth adapter for the entire system, and your application can interact with it using this object.
  • If getDefaultAdapter() returns null, then the device does not support Bluetooth.
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
    // Device does not support Bluetooth
}


2. Enable Bluetooth
  • Call isEnabled() to check whether Bluetooth is currently enable.
    • If this method returns false, then Bluetooth is disabled.
  • To request that Bluetooth be enabled, call startActivityForResult() with the ACTION_REQUEST_ENABLE action Intent.
    • This will issue a request to enable Bluetooth through the system settings (without stopping your application).
    • enabling Bluetooth succeeds ? return RESULT_OK : RESULT_CANCELED.

if (!mBluetoothAdapter.isEnabled()) {
    Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}


3.  Listen for the ACTION_STATE_CHANGED broadcast Intent

此步驟可略,但接收此 intent,有助於在程式執行中了解 Bluetooth 的狀態。
  • The system will broadcast whenever the Bluetooth state has changed
  • Contains the extra fields 
    • EXTRA_STATE: new Bluetooth status
    • EXTRA_PREVIOUS_STATE: old Bluetooth status
    • Possible values for these extra fields are STATE_TURNING_ON, STATE_ON, STATE_TURNING_OFF, and STATE_OFF.


Querying paired devices

在 scan devices 前,可以使用 getBondedDevices() 先找尋已經配對過的資訊。
Set pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0) {
    // Loop through paired devices
    for (BluetoothDevice device : pairedDevices) {
        // Add the name and address to an array adapter to show in a ListView
        mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
    }
}

All that's needed from the BluetoothDevice object in order to initiate a connection is the MAC address.



Finding Devices (concept)

找尋裝置 -> 配對 -> 連線

  • Using the BluetoothAdapter
    • Can find remote Bluetooth devices either through device discovery or by querying the list of paired (bonded) devices.
  • Device discovery
    • A scanning procedure that searches the local area for Bluetooth enabled devices and then requesting some information about each one.
    • This is sometimes referred to as "discovering," "inquiring" or "scanning".
  • A Bluetooth device within the local area will respond to a discovery request only if it is currently enabled to be discoverable. 手機必須是已設定為 discoverable 才有可能被找到。
    • If a device is discoverable, it will respond to the discovery request by sharing some information.
      • ex: the device name, class, and its unique MAC address. 
    • Using this information, the device performing discovery can then choose to initiate a connection to the discovered device.
  • Once a connection is made with a remote device for the first time
    • A pairing request is automatically presented to the user.
  • When a device is paired
    • The basic information about that device is saved and can be read using the Bluetooth APIs. 
    • Using the known MAC address for a remote device, a connection can be initiated with it at any time without performing discovery (assuming the device is within range).
Note: Being paired and being connected is the different.
  • To be paired
    • Two devices are aware of each other's existence
    • Have a shared link-key that can be used for authentication
    • Be capable of establishing an encrypted connection with each other.
  • To be connected
    • The devices currently share an RFCOMM channel.
    • Be able to transmit data with each other.
  • The current Android Bluetooth API's require devices to be paired before an RFCOMM connection can be established. (Pairing is automatically performed when you initiate an encrypted connection with the Bluetooth APIs.)


Discovering devices
  • Using startDiscovery() to start discovering devices.
    • The process is asynchronous and the method will immediately return with a boolean indicating whether discovery has successfully started.
  • The discovery process usually involves an inquiry scan of about 12 seconds, followed by a page scan of each found device to retrieve its Bluetooth name.
  • Your application must register a BroadcastReceiver for the ACTION_FOUND Intent in order to receive information about each device discovered.
    • This Intent carries the extra fields
      • EXTRA_DEVICE: BluetoothDevice
      • EXTRA_CLASS: BluetoothClass
// Create a BroadcastReceiver for ACTION_FOUND
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        // When discovery finds a device
        if (BluetoothDevice.ACTION_FOUND.equals(action)) {
            // Get the BluetoothDevice object from the Intent
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            // Add the name and address to an array adapter to show in a ListView
            mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
        }
    }
};
// Register the BroadcastReceiver
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy

Note: Performing device discovery is a heavy procedure for the Bluetooth adapter and will consume a lot of its resources.
  • Once you have found a device to connect, be certain that you always stop discovery with cancelDiscovery() before attempting a connection.
  • Also, if you already hold a connection with a device, then performing discovery can significantly reduce the bandwidth available for the connection, so you should not perform discovery while connected.


Enabling discoverability

必須要將裝置設為 discoverable 才能被搜尋到。
  • To make the local device discoverable to other devices
    • startActivityForResult(Intent, int) with the ACTION_REQUEST_DISCOVERABLE action Intent.
    • This will issue a request to enable discoverable mode through the system settings (without stopping your application).
  • By default, the device will become discoverable for 120 seconds. 
    • You can define a different duration by adding the EXTRA_DISCOVERABLE_DURATION Intent extra.
      • The maximum duration an app can set is 3600 seconds
      • A value of 0 means the device is always discoverable.
      • Any value below 0 or above 3600 is automatically set to 120 secs
Intent discoverableIntent = new
Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
startActivity(discoverableIntent);

ACTION_SCAN_MODE_CHANGED Intent
  • Notified when the discoverable mode has changed.
  • This will contain the extra fields
    • EXTRA_SCAN_MODE: new scan mode
    • EXTRA_PREVIOUS_SCAN_MODE: old scan mode
    • Possible values for each are
      • SCAN_MODE_CONNECTABLE_DISCOVERABLE: discoverable mode
      • SCAN_MODE_CONNECTABLE: not in discoverable mode but still able to receive connections
      • SCAN_MODE_NONE: not in discoverable mode and unable to receive connections
Note
  • You do not need to enable device discoverability if you will be initiating the connection to a remote device.
  • Enabling discoverability is only necessary when you want your application to host a server socket that will accept incoming connections, because the remote devices must be able to discover the device before it can initiate the connection.


By the way
  • Bluetooth Profile (藍牙規範)
    • 目的是要確保 Bluetooth 設備間的互通性(interoperability)。
      • The way a device uses Bluetooth technology depends on its profile capabilities. 
      • The profiles provide standards which manufacturers follow to allow devices to use Bluetooth in the intended manner.
    • 由藍牙技術聯盟所定義。
    • 但 Bluetooth 產品無須實現所有的 Bluetooth 規範 Profile。
    • Bluetooth 規格 1.1 定義 13 個 Profiles。
    • At a maximum, each profile specification contains information on the following topics:
      • Dependencies on other formats
      • Suggested user interface formats
      • Specific parts of the Bluetooth protocol stack used by the profile.
        • To perform its task, each profile uses particular options and parameters at each layer of the stack. This may include an outline of the required service record, if appropriate.
  • Advance Audio Distribution Profile (A2DP, 藍牙立體聲音訊傳輸規範)
    • 規定了使用藍牙非同步傳輸信道方式,傳輸高質量音樂檔案數據的協議堆棧軟體和使用方法,基於該協議就能通過以藍牙方式傳輸高品質的立體聲音樂。
    • 分為 1.1 版和 1.2 版,只要連線雙方支援 A2DP 協議都能以 16 bits,44.1 kHz的質量傳輸聲音訊號。
    • 假如有一方沒有支援 A2DP 的話,只能以 8 bits,8 kHz的質量的 Handsfree Profile 傳輸模式,聲音質量會大打折扣。



* Reference
- Bluetooth | Android Developers **
- package android.bluetooth
- Android應用程式學習筆記 - Bluetooth
- 藍牙規範 - 维基百科,自由的百科全书
- Bluetooth profile - Wikipedia, the free encyclopedia
- Android 上的 Bluetooth | 憑虛御風

2011年9月17日 星期六

[Mobile] 上網符號意義

* 這邊的 G,是由電信相關產業的聯盟所訂立下來的通訊標準。
  • 1G 代表第一世代,代表作是黑金剛手機。
  • 2G 是第二世代,代表作包括 Nokia 6150、3210、Moto小海豚之類的,而手機可以上網,是從 2G 延伸的2.5G (GPRS) 開始,另外還有 2.75G (EDGE)
  • 3G 就是我們目前普遍用來上網的技術,其中又可以分為3G、3.5G、3.75G 以及 3.9G。至於 4G,則包括 WiMAX 以及 LTE 兩項新興技術。


* 2.5G (G)
  • 傳輸速度是最慢的,最快也不過 48k 左右,大概是回到過去用電話撥號上網的時代。


* 2.75G (E)
  • EDGE (E) 傳輸速度最高可到 384kbps,但以目前使用網路的習慣,2G 以及 2.5G 大概只適合用來傳傳純文字的電子郵件。


* 3G: 3G 或是 U
  • 可以上一些簡單的入口網站找資料、看圖片,3G 的出現是真正把通訊網路帶到實用境界的關鍵。又分為:
    • GSM 系統的 WCDMA (UMTS)
    • CDMA 系統的 CDMA2000
  • 台灣多數的電信都是屬於 WCDMA 系統,僅有亞太電信採用 CDMA2000 系統。


* 3.5G、3.75G: H (HSPA 以及 HSUPA)
  • 看看Youtube、聽聽音樂不會容易LAG,有8Mbps 以上的傳輸速度。


* 3.9G 以及 4G: 目前尚不普及的技術

  • 上網速度媲美家裡的寬頻網路。
  • 3.9G 的 WiMAX 與 LTE 也可說是準 4 G,這兩項技術的傳輸速度宣稱未來(也就是現在還達不到標準) 都能達到100Mbps,而 100Mbps 也是電信產業對於 4G 門檻的共識。
  • 到了 4G 以後,最重要的里程碑是讓手機上網與家用上網的速度相差無幾。
  • 雖然國外已經有搭載 WiMAX 與 LTE 技術的手機,不過台灣目前使用的4G 技術是 WiMAX,而系統廠商目前是把 WiMAX 定調用於行動上網,至於 LTE 台灣也還沒真正開通服務,所以短時間內還看不到具備 4G 技術的手機。



* Reference
- 3G, GSM, CDMA, WCDMA, WAP, GPRS...
- 簡單認識一下智慧手機上的標誌代表什麼吧~ | Android中文資源站
- 手机上网信号符号“G”“E”“H”“T”完美解释 - MOTO DEFY(ME525)/DEFY+ 论坛 - 机锋论坛Android安卓手机平板游戏系统应用,主题壁纸铃声下载分享第一社区
- 手机屏幕上方出现H和3G符号是什么意思? - Moto Droid 2/Milestone 2 (A953) - 安卓论坛 安卓论坛-中国最大Android手机交流社区 - Powered by Discuz!

2011年3月26日 星期六

3G, GSM, CDMA, WCDMA, WAP, GPRS...

[1G - 2G - 3G]

* G 表示 Generation。

* 1G:
  • 最著名的規格是 AMPS (Advanced Mobile Phone System),ex: 黑金剛即屬此種規格下的產品。
  • 其實 Advanced 指的進階,只是比一般的室內電話更進步一點,所以就跟室內電話一樣。
  • AMPS也是類比的語音傳輸,而AMPS所採用的處理技術為 FDMA (Frequency Division Multiple Access,分頻多工存取)。

* 2G:
  • 從 1G 進步到 2G,主要的改變是從類比訊號轉為數位訊號。
  • 其中的規格並不只有一種,所採用的技術也可以粗淺的分為兩種。
    • TDMA (Time Division Multiple Access,分時多工存取): 如歐洲、台灣等地所使用的 GSM(機卡分離的設計) (Global System For Mobile Communication)與日本採用的 PDC (Personal Digital Cellular)。
    • CDMA (Code Division Multiple Access,分碼多工存取,機卡合一): 由美國 Qualcomm 公司新發展出的傳輸標準,此時的 CDMA 其實仍然屬於 2G 的範圍,後來則被通稱為所謂的窄頻 CDMA (narrow-band CDMA),以便於跟 3G 的新一代 CDMA 技術做區別。

* 3G
  • 3G 與 2G 的差異,最主要的地方在於資料傳輸的速度,換句話說也就是頻寬的增加。
  • 3G 的通訊標準不一而足,但主要都是從 CDMA 技術為藍圖而發展出來的,最著名的包括了 W-CDMA (Wide-band CDMA,也稱為CDMADirectSpread)、 CDMA 2000、以及大陸積極推動的 TDS-CDMA。這些都只是資料傳輸技術的不同。
  • 因為類比式系統有通話容量的限制,又沒有加密機制,傳輸過程中容易被竊聽,而且只提供純語音通話服務,不能傳遞文字簡訊,於是美洲地區從 AMPS 發展出 CDMA One,這是第一代的窄頻 CDMA,可以提供 64Kbps 到 115Kps 的傳輸速率。

* WCDMA (Wide band Code Division Multiple Access 寬帶分碼多工)
  • 是一種 3G 蜂窩網絡。
  • 使用的部分協議與 2G GSM 標準一致。
  • 是一種利用碼分多址復用 (或者 CDMA 通用復用技術,不是指 CDMA 標準)方法的寬帶擴頻 3G 移動通信空中接口。
  • 其支持者包括歐美的愛立信、阿爾卡特、諾基亞、朗訊、北電,以及日本的NTT、富士通、夏普等廠商。
  • 這套系統能夠架設在現有的 GSM 網路上,對於系統提供商而言可以較輕易地過渡,而GSM系統相當普及的亞洲對這套新技術的接受度預料會相當高。

* FOMA (Freedom Of Multimedia Access)
  • 並不是一種技術,而是日本 NTT DoCoMo 所推出的 3G 行動上網服務
  • 是全球第一個真正商業運行的 3G 服務
  • 採用 W-CDMA 的技術,基地台設備則由 Ericsson 提供
  • 所以拿 FOMA 來跟 W-CDMA、 CDMA 2000 或是 TDMA 來比是有概念化上的缺失,就好像拿橘子跟椅子比一樣,而日本第二大系統業者 KDDI 所推動的 3G 服務,則是以 CDMA 2000 為架構


[WAP and GPRS]
所謂的 WAP 與 GPRS,其實兩者之間也無法真正被拿來作比較,這也是目前很多很多人的一個誤解,以為 GPRS 是拿來與 WAP 相提並論的。

* WAP (Wireless Application Protocol,無線應用協定)
  • 是一種通訊協定,就好像 internet 上用的是 HTTP 一樣,而在 WAP 協定下所使用的程式語言則為 WML (Wireless Mark-Up Language)。
  • 一般我們說的 WAP 手機,其實應該是指 WAP Over Circuit-Switched Data,或是簡單一點說成 WAP Over GSM Circuit,但我們所說的 GPRS 手機上網,其實是屬於 WAP Over Packet-Switched Data,或是 WAP Over GPRS。
  • 從這邊我們可以看出來,GPRS 相對的概念其實並不是 WAP,而應該是傳統 GSM 線路的傳輸方式。

* GPRS (General Packet Radio Service,通用封包無線傳輸服務)
  • 根本上的技術是從之前 GSM 線路傳輸的 9.6Kbps,改用封包傳輸的技術,分開傳送、同步處理,使得傳輸速度得以大幅度提升,理論上可以達到 100Kbps,但目前實作出來的速度約略是在 40 ~ 50 Kbps 左右(依所利用到的 Time Slot 而定)。
  • 至於為什麼 GSM 線路傳輸的速度只有 9.6Kbps 而不是 96Kbps?
    • 一開始 GSM 規格在制定的時候,一個 Time Slot 所劃分的頻寬扣掉容錯碼後就只剩 9.6Kbps (因為一開始 GSM 仍然是拿來講電話的,當初誰會想到要用這玩意上網?),而 GPRS 技術則可以一次利用單一頻率中全部的八個時槽來傳輸資料,至於傳送的方式則是拆開成封包同步傳輸,後端再把封包組裝起來形成原始的資料 (可想像成 WinRAR 的多個壓縮檔)。
  • 但這邊又有一個技術要跟 GPRS 釐清不同的地方,那就是所謂的 HSCSD (High Speed Circuit Switched Data Service),HSCSD 與 GPRS 類似的地方是都能同時使用超過一個的時槽進行資料傳輸,但相異的地方在於 HSCSD 仍然是採用傳統 GSM 的線路傳輸技術而非 GPRS 的封包傳送。



* Reference
- 問問一些觀念問題 2G 2.5G 3G CDMA WCDMA
- 3G - CDMA, WCDMA, TD-SCDMA
- CDMA和WCDMA差在哪裡?
- 什麼是GSM、CDMA、WCDMA、PHS?

2011年2月12日 星期六

WAP

.Wireless Application Protocol( 無線應用協定)

.透過 WAP, 我們的手機就可以存取網際網路的資訊, 如同用電腦上網一樣, 

.也就是說, 有了 WAP, 我們隨時隨地都可以利用手機上網查詢資料、訂票、收發電子郵件。 

.功用類似網際網路的 HTTP 協定 但主要是用在無線通訊設備(通常是指手機, 但也可以是 PDA 之類的設備)。

.在網際網路裡, HTTP 採用的是HTML, 但在 WAP 上, 則是採用WML。

.Reference: 1