473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I dial GPRS/EDGE in Win CE?

Hello all.

I am developing application in python on Windows CE which needs connection to the internet (via GPRS/EDGE). When I turn on the device, the internet connection is not active. It becomes active if I open internet explorer.

I would like to activate connection in my application. I'm trying to do this with RasDial function over ctypes library, but I can't get it to work. Is this the right way or I should do something else?

Below is my current code. The ResDial function keeps returning error 87 – Invalid parameter. I don't know anymore what is wrong with it.

I would really appreciate any kind of help. Thanks in advance.

Expand|Select|Wrap|Line Numbers
  1. #encoding: utf-8
  2.  
  3. import ppygui as gui
  4. from ctypes import *
  5. import os
  6.  
  7. class MainFrame(gui.CeFrame):
  8.     def __init__(self, parent = None):
  9.         gui.CeFrame.__init__(self, title=u"Zgodovina dokumentov", menu="Menu")
  10.  
  11.         DWORD = c_ulong
  12.         TCHAR = c_wchar
  13.         ULONG_PTR = c_ulong 
  14.  
  15.         class RASDIALPARAMS(Structure):
  16.              _fields_ = [("dwSize", DWORD),
  17.                          ("szEntryName", TCHAR*21),
  18.                          ("szPhoneNumber", TCHAR*129),
  19.                          ("szCallbackNumber", TCHAR*49),
  20.                          ("szUserName", TCHAR*257),
  21.                          ("szPassword", TCHAR*257),
  22.                          ("szDomain", TCHAR*16),
  23.                          ]
  24.  
  25.         try:
  26.             param = RASDIALPARAMS()
  27.             param.dwSize = 1462 # also tried 1464 and sizeof(RASDIALPARAMS()). Makes no difference.
  28.             param.szEntryName = u"My Connection"
  29.             param.szPhoneNumber = u"0"
  30.             param.szCallbackNumber = u"0"
  31.             param.szUserName = u"0"
  32.             param.szPassword = u"0"
  33.             param.szDomain = u"0"
  34.  
  35.             iNasConn = c_ulong(0)
  36.             ras = windll.coredll.RasDial(None, None, param, c_ulong(0xFFFFFFFF), c_voidp(self._w32_hWnd), byref(iNasConn))
  37.             print ras, repr(iNasConn) #this prints 87 c_ulong(0L)
  38.         except Exception, e:
  39.             print "Error"
  40.             print e
  41.  
  42. if __name__ == '__main__':
  43.    app = gui.Application(MainFrame(None))
  44.    # create an application bound to our main frame instance
  45.    app.run()
  46.    #launch the app !
  47.  
  48.  
Jun 10 '10 #1
0 1476

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Choubey | last post by:
hi, wanna want to know how can i develop j2me two player game by using gprs in which both players play symultaneosly.i develop a two player game by using bluetooth in which both player can play at...
1
by: John | last post by:
Hi, I want to write an application that has the ability to bringup and takedown a dialup connection? How could this be done? Is there a way to bring up and takedown a dialup connection from...
0
by: M.E. | last post by:
I am very new to C#. I like to programatically dial GPRS from a PDA. I have tried using RasDial. However due to my lack of experience in writting C# code it is not working. Could any body send me a...
0
by: Nekhamkin Andrey | last post by:
Hi! I have a problem: Device communicating via GPRS with server (ASP.Net + C#). Server need to make response (HTTP, short message) and disconnect client (GPRS-device). I wrote...
1
by: abhya | last post by:
Hello evryone... I am a s/w undergrad.I am attempting to establish a private point-2-point link betn my GPRS enabled cellphone and a dedicated college server, over the GPRS.I will be using java...
3
by: iKiLL | last post by:
Hi , I am trying to debug a problem with a Windows Mobile Application. I need the PDA to Sync(I have writen the sync process myself using a web service) using GPRS while Debugging from the VS...
2
by: danielle colaco | last post by:
hi, i'm a new user of java and require to do the following tasks using java 1.connect a GPRS modem to a PC. 2. send a message over GPRS to another GPRS device (could be a GPRS modem connected...
4
by: ktg024 | last post by:
I have a GPRS modem, Now I want to connect this(GPRS MODEM) to my website and transfer data. I have a temperature of particular area i want to send through GPRS every ten minutes to my (server)...
2
by: Aruforum | last post by:
Hi Guys, This is Rajesh.N. I am new to this forum. I am very glad to join with u genius pupils. Presently i am working in Gps project in .net domain. In my project i need to implement...
0
by: devidasari | last post by:
I have to interface the gprs modem to the serial port of beagle board before that i have to add gprs application program in the android OS. From where we get the gprs interfacing application. we...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.