2016-07-02 2 views
0

Windows Mobile 6을 실행하고 Compact Framework 3.5로 개발중인 Ciperlab 스캐너가 있습니다. 전화를 걸어야하며 통화가 완료되면 운영자가 거래를 완료 한 프로그램으로 돌아갑니다. phone.dll 함수에서 PhoneMakeCall 함수를 사용했지만 결과 패널에 여러 버튼이 필요합니다. 완벽한 솔루션은 전체 전화 패널을 숨기는 것입니다. 이전에이 작업을 해본 사람의 솔루션은 대단히 환영 할 것입니다. 나는 그 기술이 오래되었다는 것을 알고 있지만, 스캐너와 함께 붙어있다.API to PocketPC Windows Mobile 6

답변

1

전화를 걸려면 Telephony API (TAPI)를 사용해야합니다. 이것은 MS가 제공하는 API입니다. 전화를 걸려면 많은 코드 라인이 필요하며 OpenNetCF Telephony Compact Framwork Class와 같은 래퍼를 사용하는 것이 더 쉽습니다. Here이 그 예입니다. TAPI 사용에 대한 예제는 other입니다.

MS에서 사용 가능한 TAPI 사용에 관한 사소한 정보가 있습니다.

일부 장치 공급 업체는 코드로 전화에 액세스 할 때 장치를 지원하는 특수 Phone SDK를 제공합니다. 예 : Intermec WWAN Toolkit.

먼저 openNetCF를 사용합니다.

0

정보 주셔서 감사합니다. 그것은 좋았어요

첫 번째 링크로 이동합니다 :

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 파일에 포함되어 있지만이 버전에는 라이센스가 필요하며 샘플에서 사용하는 모든 메소드가 없습니다. 압축 된 소스 코드를 다운로드하여 컴파일했습니다. 몇 가지 문제가 있지만 잘 작동합니다.

하나의 중요한 문제가 있습니다. 배터리를 절약하기 위해 휴대 전화를 끕니다. 전화를 걸기 전에 30 초 동안 켜야합니다. 그렇지 않으면 시스템이 전화기 원시 패널에 떨어집니다. 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) 
:

내가 참조를 위해 내 마지막 코드를 첨부

관련 문제