Read phoneBook of a SIM card on a Smartphone
Bonjour, j'essaie de lire le rpertoire d'un smatphone, voici mon code :
-
<StructLayout(LayoutKind.Sequential)> _
Public Structure SimPhoneBookEntry
Public cbSize As IntPtr
Public dwParams As IntPtr
Public dwAddressType As IntPtr
Public dwNumPlan As IntPtr
Public lpszAddress As IntPtr
Public lpszText As IntPtr
End Structure 'SimPhoneBookEntry
Public Shared Function ReadPhonebookEntry() As Char()
Dim hSim, res As IntPtr
hSim = IntPtr.Zero
Dim temp As Long
'avant toute manipulation sur la carte SIM, il est indispensable de l'initialiser
res = SimInitialize(IntPtr.Zero, Nothing, IntPtr.Zero, hSim)
'on traite ici l'ventuelle erreur d'initialisation de la carte SIM
If (res.ToInt32 <> 0) Then
Throw New Exception("Could not initialize Sim.")
End If
Dim phonebookEntry As New SimPhoneBookEntry
res = SimReadPhonebookEntry(hSim, IntPtr.op_Explicit(SIM_NUMPBSTORAGES), 32, phonebookEntry)
SimDeinitialize(hSim)
Return System.Runtime.InteropServices.Marshal.PtrToStringUni(phonebookEntry.dwAddressType)
End Function
-
Normalement, je devrais retrouver toutes les informations dans phonebookEntry...
On est bien d'accord?
Et ba rien du tout !
Si quelqu'un peut m'indiquer mon/mes erreur(s) ce serait cool
Merci d'avance
[1427 byte] By [
jjm] at [2008-1-19]
Read data on a SIM card (PhoneBook)
It migth be better for you in english... isn't it ? 
Hi,
I'm trying to read the entries of the phoneRepertory of a smart phone (accessing datas of the SIM card)
here is my code :
-
<StructLayout(LayoutKind.Sequential)> _
Public Structure SimPhoneBookEntry
Public cbSize As IntPtr
Public dwParams As IntPtr
Public dwAddressType As IntPtr
Public dwNumPlan As IntPtr
Public lpszAddress As IntPtr
Public lpszText As IntPtr
End Structure 'SimPhoneBookEntry
Public Shared Function ReadPhonebookEntry() As Char()
Dim hSim, res As IntPtr
hSim = IntPtr.Zero
Dim temp As Long
'avant toute manipulation sur la carte SIM, il est indispensable de l'initialiser
res = SimInitialize(IntPtr.Zero, Nothing, IntPtr.Zero, hSim)
'on traite ici l'ventuelle erreur d'initialisation de la carte SIM
If (res.ToInt32 <> 0) Then
Throw New Exception("Could not initialize Sim.")
End If
Dim phonebookEntry As New SimPhoneBookEntry
res = SimReadPhonebookEntry(hSim, IntPtr.op_Explicit(SIM_NUMPBSTORAGES), 1, phonebookEntry)
SimDeinitialize(hSim)
Return System.Runtime.InteropServices.Marshal.PtrToStringUni(phonebookEntry.dwAddressType)
End Function
-
I should find informations about the first entry in phonebookEntry object, but there is nothing in.
Does someone could explain me my error.
Thanks a lot
jjm at 2007-8-21 >
