2016-07-02 8 views
0

私は、Windows Mobile 6を実行し、コンパクトなフレームワーク3.5で開発しているCiperlabスキャナを持っています。私は電話をかける必要があり、通話が完了したらオペレータが取引を完了するプログラムに戻る。私はphone.dllでFunction PhoneMakeCallを使用しましたが、結果として得られるパネルにはいくつかのボタンが押されている必要があります。完璧なソリューションは、電話パネル全体を隠すことです。この前にこれを行った人のソリューションは大歓迎です。私はテクノロジーが古くなっていることを知っていますが、スキャナに付属するように私はそれに固執しています。API to PocketPC Windows Mobile 6

答えて

1

電話をかけるには、Telephony API(TAPI)を使用する必要があります。これは、MSが提供するAPIです。電話をかけるには多くのコードラインが必要です.OpenNetCF Telephony Compact Framwork Classesのようなラッパーを使用する方が簡単です。 Hereがその例です。 TAPIの使用例はotherです。

TAPIの利用には、マイナーな情報しかありません。

一部のデバイスベンダーは、電話機にコードでアクセスするためのデバイスをサポートするための特別なPhone SDKを提供しています。たとえば、Intermec WWAN Toolkitなどです。

私はまずopenNetCFに行きます。

0

ありがとうございました。情報josef。それは偉大だった

最初のリンクはが表示されます:

http://programmaremobile.blogspot.co.za/2009/10/how-to-make-call-with-opennetcf-tapi.html

これはOpenNetCfへのリンクがありますが、ここでラッパー(OpenNETCF.Telephony.dll)が削除されました。ラッパーといくつかのサンプルのソースコードを持つhttp://tapi.codeplex.com/への別のリンクがあります。 OpenNETCF.Telephony.dllはサンプルのzipファイルに含まれていますが、このバージョンにはライセンスが必要で、サンプルで使用されているすべてのメソッドもありません。私は圧縮されたソースコードをダウンロードしてコンパイルしました。いくつかの問題がありますが、うまくいきます。

私には1つの顕著な問題があります。バッテリーを節約するために、私は電話を切る。電話をかける前に30秒間オンにする必要があります。そうしないと、システムは電話機のrawパネルにドロップします.GSMネットワークが安定し、通話が可能であることを知らせるステータスイベントはありません。現時点で私はタイマーを使用していますが、これはきれいな解決策ではありません。

In Declarations 
Imports OpenNETCF.Telephony 
Friend WithEvents tapi As Telephony 
Friend WithEvents CellLine As Line 
Friend WithEvents CellCall As [Call] 
Public CellPhoneCoverage As Boolean = False 
Shared CellCallState As Integer = 1 

Private Function CreateCellLine() As Boolean 
Dim i As Integer 
Dim dc As DeviceCapabilities 
'Open Tapi 
Try 
    tapi = New Telephony 
    tapi.Initialize() 
    If tapi.NumberOfDevices > 0 Then 
    Try 
     For i = 0 To tapi.NumberOfDevices - 1 
     tapi.GetDeviceCapabilities(i, dc) 
     If (dc.MediaModes And MediaMode.InteractiveVoice) = _ 
       MediaMode.InteractiveVoice Then 
      'found the cellular line 
      CellLine = tapi.CreateLine(i, dc.MediaModes, _ 
       CallPrivilege.None)          
      'To save battery turn off phone. 
      'Note that it must be turned on for 30 seconds 
      ' before making a call otherwise we drop into the 
      ' phone raw panels 
      NativeMethods.lineSetEquipmentState(CellLine.hLine, _ 
         EquipmentState.Minimum) 
      CreateCellLine = True 

      'if battery is not an issue then check phone state 
      'Dim es As EquipmentState 
      'Dim rs As RadioState 
      'NativeMethods.lineGetEquipmentState(CellLine.hLine, es, rs) 
      'CreateCellLine = (es = EquipmentState.Full And rs = RadioState.On) 
      Exit Function 
     End If 
     Next 
     MsgBox("cell line not found") 
     CreateCellLine = False 
    Catch ex As Exception 
     CreateCellLine = False 
      MsgBox("CreateCellLine(1):" & ex.Message) 
    End Try 
    End If 
Catch ex As Exception 
    CreateCellLine = False 
    MsgBox("CreateCellLine(2):" & ex.Message) 
End Try 
End Function 

Handle events: 
Private Sub CellCall_CallState(ByVal [call] As OpenNETCF.Telephony.Call, _ 
      ByVal state As OpenNETCF.Telephony.CallState) _ 
      Handles CellCall.CallState 
'Note that this state change is not called for disconencted and connected events 
    MsgBox("Call state is " & state.ToString()) 
End Sub 

Private Sub CellCall_Connected(ByVal [call] As OpenNETCF.Telephony.Call, _ 
      ByVal state As OpenNETCF.Telephony.CallState) _ 
      Handles CellCall.Connected 
    MsgBox("Connected") 
End Sub 

Private Sub CellCall_Disconnected(ByVal [call] As OpenNETCF.Telephony.Call, _ 
      ByVal state As OpenNETCF.Telephony.CallState) _ 
      ByVal disconnectMode As OpenNETCF.Telephony.DisconnectMode) _ 
      Handles CellCall.Disconnected 
    MsgBox("Disconnected") 
End Sub 

In the form_load procedure: 
    'Open Tapi and check we have cell phone coverage 
    CellPhoneCoverage = CreateCellLine() 

To make a call: 
    'If the phone if off then it must be turned on for 30 seconds 
    ' before making a call otherwise we drop into the phone raw panels 

    Dim rc As Integer 
    Dim es As EquipmentState 
    Dim rs As RadioState 
    NativeMethods.lineGetEquipmentState(CellLine.hLine, es, rs) 
    If Not (es = EquipmentState.Full) Then 
    rc = NativeMethods.lineSetEquipmentState(CellLine.hLine, EquipmentState.Full) 
    Else 
    If (es = EquipmentState.Full And rs = RadioState.On) Then 
     CellCall = CellLine.MakeCall("0812500163", 27, False) 
    End If 
    End If 

To end a call: 
    CellCall.Hangup() 
    If Not ((CellCallState = OpenNETCF.Telephony.CallState.Idle) Or _ 
      (CellCallState = OpenNETCF.Telephony.CallState.Disconnected)) Then 
    'must do check otherwise get a null exception 
    Try 
     CellCall.Hangup() 
     Catch ex As Exception 
     MsgBox("CellCall.Hangup: " & ex.Message) 
    End Try 
    End If 

    'if battery is not an issue then leave phone on 
    ' remember when making a call allow time for the network to connect 
    ' otherwise we drop into the phone raw panels 
    NativeMethods.lineSetEquipmentState(CellLine.hLine, _ 
       EquipmentState.Minimum) 

私は参考のために私の最終的なコードを添付しています

関連する問題