隨筆 - 67  文章 - 79  trackbacks - 0
          <2009年3月>
          22232425262728
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          相冊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          6.2 telephone —電話服務
          這個模塊提供了使用電話的api
          因為設備用戶也可以手動明確的掛起電話,所以這會影響到當前的通話狀態。補充,使用這個模塊在模擬器上不會有效果因為不能得到通話。
          此telephone模塊有下列函數。

          dial(number)
               撥打number指定的號碼,number 是一個字符串,例如 u'+358501234567' 此處'+'表示國際前綴,'358'為國家代號,'50'為移動網絡代號(或地區代碼) '1234567'為用戶電話。如果有一個進行中的通話早于在python中的撥號,那么先前的通話被掛斷然后新的通話被建立。

          hang_up()
             嘗試掛起調用此函數進程中的一個被dial 函數建立的通話。如果通話已經完成,拋出 SymbianError: KErrNotReady


          Note: The following functions and data items are available from S60 3rd Edition onwards (inclusive).
          incoming call()
               Wait for incoming call, returns immediately. If a call arrives, answer can be called to answer the call. Without the invocation of function incoming call, the function answer has no effect.
          answer()
               Answers an incoming call - see also incoming call.
          call state(callable)
               The callable will be called when there are changes in the telephone line (lines) in the device. The argument for the call is a tuple with first item the possible new state and the second item, the possible incoming call number as a Unicode string.
               The possible states in the tuple are defined as telephone module constants.

          messaging 模塊提供消息服務api。目前,messaging 模塊有函數:
          The messaging module offers APIs to messaging services. Currently, the messaging module has functions:

          sms_send(number, msg, [encoding=’7bit’, callback=None, name=”” ])
                 發送一個主體為文字(unicode 編碼)的SMS 消息到指定電話號碼(為字符串)
                 Sends an SMS message with body text msg 4 (Unicode)to telephone number number (string).
                可選參數 encoding被用來定義消息編碼。
                 The optional parameter encoding is used to define encoding in the message. The parameter values  can be ’7bit’, ’8bit’ or ’UCS2’.
                 可選參數callback 根據當前發送操作狀態被執行。可用的狀態定義在messaging 模塊的數據成員中。如果前一次發送請求正在進行,再執行另外一次發送, 將拋出RuntimeError
                 The optional parameter callback is invoked with the current status of the send operation as parameter. The possible states are data items in the module messaging. Invoking another send while a previous send request is ongoing will result in RuntimeError being raised.
                 如果callback 沒有提供,sms 發送函數將阻塞直到隊列中的消息被刪除或發生發送錯誤。
                 If the callback is not given, the sms send function will block until the message in the queue is either deleted or the sending has failed5 .
               可選參數name在消息成功發送到號碼后 ,將顯示在發件箱中,表示接受消息者名稱。如果參數沒有提供,那么接受者電話號碼將被顯示在 發件箱中。
                 The optional parameter name will be shown in the sent item message entry as recipient’s name after successfully sending message to number . If this parameter is not specified, then the recipient’s phone number will be shown in the sent item message entry6 .


          example:

          >>> import messaging
          >>>
          >>> def cb(state):
          ...   if state==messaging.ESent:
          ...     print "**Message was sent**"
          ...   if state==messaging.ESendFailed:
          ...     print "**Something went wrong - Truly sorry for this**"
          ...
          >>> messaging.sms_send("1234567", "Hello from PyS60!", ’7bit’, cb, "Mary")
          >>> **Message was sent** # This is printed from the callback


          mms_send(number, msg, [attachment=None ])
                 Note: Available from S60 3.0 onwards (inclusive).
                 Sends an MMS message with body text msg (Unicode) to telephone number number (string). The
                 optional parameter attachment is full path to e.g. image file attached to the message.


          posted on 2009-03-16 15:32 zarra 閱讀(330) 評論(1)  編輯  收藏

          FeedBack:
          # re: pys60 文檔 簡單翻譯[未登錄] 2009-03-17 18:21 apple
          好牛啊,連這個都被你研究出來了~~~~~~~~  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 德令哈市| 贵港市| 冷水江市| 黑龙江省| 津南区| 石屏县| 抚顺市| 基隆市| 安徽省| 合作市| 红原县| 广昌县| 拉萨市| 呼和浩特市| 华阴市| 迁西县| 长治县| 宣城市| 诏安县| 新化县| 天台县| 隆安县| 万载县| 乃东县| 双牌县| 德州市| 舞阳县| 武平县| 柳河县| 凤翔县| 扶绥县| 德州市| 五峰| 普安县| 长汀县| 凤山市| 遂溪县| 乐都县| 淮南市| 老河口市| 宁蒗|