GSM Delay - Windows Mobile Development and Hacking General

Hi,
I want to send time critical data over a GSM connection. I establish the
connection with the TAPI interface.
My problem is the very big delay between sending a Byte at device a and
receiving a byte at device b.
I test it in the following way:
* device send one byte and start a counter
* device b receive the byte and send it back
* device a receive the byte and stop the counter
the result:
device a | device b | delay
MDA | ISDN | over 1600 ms
SDA | ISDN | 688 ms
MDA | SDA | 884 ms
SDA | MDA | 1836 ms
SDA | SDA | 869 ms
What's going wrong?
My CSD-type is V.110 transparent
MDA = T-Mobile MDA I = HTC Wallaby (I think)
SDA = T-Mobile SDA I = HTC Tornado
I use the following functions:
* lineGetID(0, 0, hCall, LINECALLSELECT_CALL, lpVarStr, TEXT("comm/datamodem")) ;
* sHandle = *(LPHANDLE)((BYTE*)lpVarStr + lpVarStr->dwStringOffset);
* COMMTIMEOUTS commTimeouts;
GetCommTimeouts (sHandle, &commTimeouts);
commTimeouts.ReadIntervalTimeout = MAXDWORD;
commTimeouts.ReadTotalTimeoutMultiplier = MAXDWORD;
commTimeouts.ReadTotalTimeoutConstant = 2000;
commTimeouts.WriteTotalTimeoutMultiplier = 1;
commTimeouts.WriteTotalTimeoutConstant = 1;
SetCommTimeouts (sHandle, &commTimeouts)
* WriteFile (sHandle, data, tSize, &sent, NULL);
* ReadFile (sHandle, data, rSize, &tSize, 0);
Thanks a lot
Thomas

for your real problem I have no solution - could be bound to GSM specifics.
Nevertheless Threading is not all that good on Pocket PC's - I get better results when calling Application.DoEvents very often. = they delay could also between OS and Application!
BR
Daniel

You haven't any problem.
Delays you are achieved is relatively normal for CSD GSM communication. At least I have measured approximately same values.
~600-900ms round trip time for "transparent" mode
and
~1000-1500ms for "nontrasparent"
And more - these delays aren't stable - you easily ca achieve 3000 ms as pick value for dalay.
In case of "nontransparent" communication delays usualy are biger and show tendency to growing more often.
Grigory.

I don't see any problem with threading. What do you mean "not all that good". I use threads a lot and found them to be very predictable and in many cases the best way to get a result. When using writefile with tapi or communicating over sockes I have found no noticeable delay between my application and the os. As long as the threads are synchronized propperly and sometimes give up their time slice when not in important code many threads can get along fine in one app.
As for the time taken, 1000ms for a byte is not good - its very poor. I have found this to happen when using writefile with single bytes with the phone handle. Try sending much larger size data and work out what the time is per byte and I think you will see a huge decrease in the time per byte achived. Strangley I have not found the same dellays in using readfile to read single bytes at a time.
I just sent a 13312 byte file with GSMbeam and it took ~24 seconds (after the handshake). Thats 1.8ms per byte (correct me if my math is wrong).

Question was (as I understand) in propagation time of byte - not about bandwidth.
Yes you can send approximately up to 1.1 kbytes per second in "nontrasparent" mode. But the problem is in time byte (right now have been sent) needs to reach "receiver".
Grigory

Hi,
thank you for your answers and sorry for my late reply.
I can't use "Application.DoEvents", because I program in C++ not in C#.
The problem is the delay not the bandwidth. Ok, GSM data have a round trip delay between 500 and 1000ms.
A normal Voice call haven't this delay. Is it possible to use it for data communications? Are there workarounds?
But why is it bigger on a pocket pc?
On MDA (~200 Mhz, HTC Wallaby) and XDAmini (300 Mhz, HTC Magician ?) I have delays over 1000 ms. But not on a 200 Mhz smartphone ( HTC Tornado). The difference are one second and more?
Is this related to any windows parameter?
Thanks
Thomas

Related

GPRS

Hi I am very new to C# and compact framework. I have been coding for XDA's using eVB. I want to be able to enable the GPRS mode and also be able to Hangup.
Do I use RasDial? Is this an achievable task for a C# beginer? Could someone please give me some hints as how to achieve this.
Highflyer,
Firstly, why move over to C# when you can achieve what you want using VB.NET. Like yourself, I have ported across an eVB Rasdial app across to .NET CF. Secondly, with GPRS remember that you only pay for the data that is transferred over the connection, so you dont need to worry about the disconnection, but this can be done manually by putting the XDA into FLIGHT MODE. I think you will find another thread covering how to do this programmatically in this forum.
In my app, my XDA is sending and requesting XML packets over HTTP to a web server. To do this I use the HttpWebRequest and HttpWebResponse classes.
Here is a snippet of code
*******************************
Public Function Post(ByVal sURL As String, Optional ByVal strRequest As String = "", Optional ByVal blnRetValExpected As Boolean = False, Optional ByRef strReturned As String = "", Optional ByRef intStatus As Integer = 0) As Boolean
Dim WebReq As HttpWebRequest
Dim WebRes As HttpWebResponse
Dim bOK As Boolean
Try
WebReq = CType(WebRequest.Create(sURL), HttpWebRequest)
If strRequest <> "" Then
Dim encoding As New ASCIIEncoding
Dim byte1 As Byte() = encoding.GetBytes(strRequest)
WebReq.Method = "POST"
WebReq.ContentType = "application/x-www-form-urlencoded"
WebReq.ContentLength = strRequest.Length
Dim newStream As Stream = WebReq.GetRequestStream()
newStream.Write(byte1, 0, byte1.Length)
newStream.Close()
End If
WebRes = CType(WebReq.GetResponse(), HttpWebResponse)
If WebRes.StatusCode = HttpStatusCode.OK Then
bOK = True
End If
intStatus = WebRes.StatusCode
Catch ex As InvalidOperationException
bOK = False
Catch ex As WebException
bOK = False
Catch ex As ProtocolViolationException
bOK = False
End Try
If bOK And blnRetValExpected Then
If WebRes.ContentLength > 0 Then
Dim sResponse() As Byte
Dim ReceiveStream As Stream = WebRes.GetResponseStream()
Dim encode As encoding = encoding.GetEncoding("utf-8")
Dim ReadStream As New StreamReader(ReceiveStream, encode)
Dim strXML As String = ""
Try
strXML = ReadStream.ReadToEnd()
Catch ex As Exception
strXML = ""
bOK = false
Finally
ReadStream.Close()
End Try
strReturned = strXML
End If
End If
WebRes.Close()
Post = bOK
End Function
*******************************
What you will find with the above code is that there is no code for making the GPRS connection and RasDial is no longer required. This is due to the code being hidden away in the HttpWebRequest class and the GPRS connection will use the current connection if it exists or prompt the user for the connection to use. The prompting can be overcome by setting a defualt GPRS connection in Settings - Connection Manager, and saving the password along with it. HTH.
Tony,
Many thanks for your advice. The included sample code is very useful. The problem is I have to stick with C#, wether I like it or not. However I can follow your code to reporoduce something similar in C#. I have already used Post in eVB, to send data, however I changed over to using sockets (WinSock), since I understand there is lower data over head in using sockets. I appreciate any comments you may have with this choice.
One question, you mentioned that when we connect to GPRS we do not pay for actual connection. Is this right, my understanding was when the device connects to GPRS, some data is used to achieve this connection, thus just establishing a connection to GPRS would cost. I am thinking of the situation when GPRS has to be enabled and disabled hundreds of times a day.
Thanks again, looking forward to hear any comments.
Highflyer,
Regarding a connection charge - you may be right about this depending on the type of contract you are on, but as I mentioned once a connection is established you are only charged for the data that is transferred over the connection, so why not leave the connection open then there will only be the one connection charge. If the connection is lost due to poor signal then the underlying code of the web components will re-establish the connection as and when required. HTH.
Thanks for your advice.
I am still very interested to be able to perform RasDial using C#. As I said I have tried to write the code however due to my lack of experience in using C# the code does not work.
Any Ideas or advice anybody.
Thanks
WebRequest on Magician/XDA Mini?
Hi there!
I´m glad finding .NET developers here ;-)
I have a big, big problem:
On several XDA Mini´s (HTC Magician) the HttpWebRequest or WebRequest methods instantly return with an exception (ConnectFailure), even if Pocket IE or other software can reach the net. I´ve tested both, connection via ActiveSync and GPRS, but it does not work.
Any ideas on this? Is it a known issue, and is there a way to solve it?
Thanky in advance,

MMS Video Length

Maybe this topic has been discussed but I cant find it anywhere.
I was wondering if it is possible to increase the MMS video length on my MDA Vario more than the measly 5seconds that it can at the moment.
I think the Vario is the best phone I have had but this is one thing that I would like to change.
There is only so much abuse you can cram into 5 seconds when sending video to your mates!!!!
thanks
Code:
HKLM\SOFTWARE\HTC\camera\AppDefSettings\P3\EnableLimit = 0
Disables the MMS Video 3gp recording duration limit. Mind you that you may not be able to send any MMS with longer video (due to size restrictions).
OR
Code:
HKLM\SOFTWARE\HTC\camera\AppDefSettings\P3\LimitSize = 80 (DWORD decimal)
That 80 = 80KB. If you know the maximum size your (and the receiving) operator supports, subtract 16k from that, and use that value. 16 should be enough for all header data, any text you add, etc.
Thanks for that worked great.
100k is the limit for Orange UK (or so they said)
I guess that is 84 for the DWORD

TAPI weird problem with callerid

Hi Guys:
I'm having a weird problem with TAPI, basically I'm developing an app that intercepts incoming calls and then extract the callerid before starting recording the call.
I'm using WM 2005 and the device is an HTC Universal (T-Mobile MDA PRO) with a T-Mobile UK SIM.
All seems to work fine, the event loop receive the message(s) ,first receives an LINE_APPNEWCALL and then LINE_CALLINFO with dwParam1 set to LINECALLINFOSTATE_CALLERID, but when calling lineGetCallinfo to get the CallerID , the callerid flags (dwCallerIDFlags) returns 32 or "Unknow", even when the built-in alert in the phone is showing the caller id!
I killed cprog.exe from the process viewer (the phone didn't rang so the process was in fact killed) but not difference...Any ideas? Any tricks? Below a copy of the loop that I'm using:
void FAR PASCAL lineCallbackFunc(
DWORD hDevice,
DWORD dwMsg,
DWORD dwCallBackInstance,
DWORD dwParam1,
DWORD dwParam2,
DWORD dwParam3)
{
DWORD dwT = dwMsg;
LINECALLINFO *lpCallInfo;
size_t ci_size = sizeof(LINECALLINFO);
TCHAR *buffNum;
long Err;
OutputDebugString(_T("CB\n"));
switch (dwMsg){
case LINE_CALLINFO: {
switch(dwParam1)
{
case LINECALLINFOSTATE_CALLEDID:
{
OutputDebugString(_T("CALLID"));
break;
}
case LINECALLINFOSTATE_CALLERID:
{
OutputDebugString(_T("CALLERID"));
lpCallInfo = (LINECALLINFO *)calloc(ci_size,1);
lpCallInfo->dwTotalSize = ci_size;
Err = lineGetCallInfo((HCALL)hDevice,lpCallInfo);
if((DWORD)lpCallInfo->dwCallerIDFlags & (LINECALLPARTYID_ADDRESS | LINECALLPARTYID_PARTIAL)) {
_tcsncpy(buffNum, (LPTSTR)((BYTE*)lpCallInfo + lpCallInfo->dwCallerIDOffset), 256);
OutputDebugString(buffNum);
}
break;
}
break;
}
case LINE_APPNEWCALL:
{
OutputDebugString(_T("Newcall"));
// HCALL hCall = (HCALL)dwParam2;
break;
}
}
}
}
#define TAPI_API_LOW_VERSION 0x00020000
#define TAPI_API_HIGH_VERSION 0x00020000
#define EXT_API_LOW_VERSION 0x00010000
#define EXT_API_HIGH_VERSION 0x00010000
And here is how the TAPI starts: (in Main):
liep.dwTotalSize = sizeof(liep);
liep.dwOptions = LINEINITIALIZEEXOPTION_USEHIDDENWINDOW ;
if (lineInitializeEx(&hLineApp, 0, lineCallbackFunc, NULL,
&dwNumDevs, &dwAPIVersion, &liep))
{
goto cleanup;
}
OutputDebugString(_T("Init"));
// get the device ID
dwTAPILineDeviceID = GetTSPLineDeviceID(hLineApp, dwNumDevs,
TAPI_API_LOW_VERSION,
TAPI_API_HIGH_VERSION,
CELLTSP_LINENAME_STRING);
// error getting the line device ID?
if (0xffffffff == dwTAPILineDeviceID)
{
goto cleanup;
}
// now try and open the line
if(lineOpen(hLineApp, dwTAPILineDeviceID,
&hLine, dwAPIVersion, 0, 0,
LINECALLPRIVILEGE_MONITOR, dwMediaMode, 0))
{
goto cleanup;
}
// set up ExTAPI
if (lineNegotiateExtVersion(hLineApp, dwTAPILineDeviceID,
dwAPIVersion, EXT_API_LOW_VERSION,
EXT_API_HIGH_VERSION, &dwExtVersion))
{
goto cleanup;
Any help will be really helpfull, thanks.
Check your return value from lineGetCallInfo
check your return value from lineGetCallInfo. It will be LINEERR_STRUCTURETOOSMALL because lpCallInfo points to a buffer that's too small. (LINECALLINFO is a variably sized data structure) If you failed to make it large enough, you can allocate memory of size lpCallInfo->dwNeededSize and call lineGetcallInfo again. (look at documentation for lineGetCallInfo and LINECALLINFO)
Thanks for your reply, I checked the return value and is 0 so the size is fine (in fact dwSizeNeeded is greater than dwTotalSize so that is no problem), however I will change that bit just in case.
The interesting thing is that lpcallinfo structure returns "32" (UNKNOWN) for the dwCallerIDflags, even when the built-in notification program (cprog.exe) shows the callerid with no problem.
I even killled cprog.exe before testing and is the same, I wonder if there is something related with the Service Provider (T-Mobile) or some other setting that is interfering or no standard.
Any tip or suggestion is appreciated and welcome.
Thanks
Instead of testing the flag, test if dwCallerIDSize>0. Thats what I do. I have systematically gone through all values in the LINECALLINFO and most of them are zeroed out by the network regardless of what should be in them so I inclined to not trust it.
Also it could be your timing. Are you checking every time a LINE_CALLINFO/LINECALLINFOSTATE_CALLERID comes in or just once. The caller id is not always available on the first time but on subsequent messages is available.
Also it cant hurt to add extra memory to the LINECALLINFO. Just +1024 to be sure there is space for the caller id (or any other appended data before the caller id). You said dwSizeNeeded > dwTotalSize, that means you do not have enough memory and need to rellocate and call lineGetCallInfo again to refill the LINECALLINFO.
You do not need to kill the phone app (cprog.exe) to get caller id. It is a very bad idea to kill it without good reason. IMO the only valid reason to kill it would be to allow user interaction with your window during this time. There are side affects from killing cprog that can include uncontrollable vibration that requires a reset to stop if you have not prevented it programatically.
dwSizeNeeded is the amount needed to store the structure.
dwSizeTotal is the amount you provided.
if dwSizeNeeded > dwSizeTotal then there isn't enough room.
Are you sure that lineGetCallInfo returned 0?
If any of the dwXXXXSize members of LINECALLINFO struct are non-zero (which seams very likely), then you will need more than sizeof(LINECALLINFO) bytes.
I agree with OdeeanRDeathshead, no need to kill cprog. This will work without that. If I ever want to kill cprog, I usually replace cprog by a program with sleep(60*60*24) in a loop, then reboot. Or I replace it with the program I'm testing and reboot. On my phone, this doesn't seam to cause problems. If I just kill cprog, it will be restarted within a few minutes.
I also just check whether dwCallerIDSize > 0.
good luck
I you don't get it working, I was wondering if you could post your values for dwSizeTotal , dwSizeNeeded, and dwSizeUsed.
Thanks guys, you were totally rigth! The problem was that I was expecting the API (lineGetCallInfo) to return STRUCTURE_TOO_SMALL error and I didn't make any check on dwSizeNeeded.
Funny enough, the API returned no error at all and even the structure had some data on it, but it wasn't big enough, so basically I added a loop to check the Size and reallocate memory until is enough, it works like a charm now.
On a separate note, on outgoing calls I had to introduce a small delay, the CalledID information it doesn't become instantly, by testing in the HTC Universal seems to be slow on outgoing calls, I hope that wont be any trouble there.
Thanks again guys for your help, it saved me a lot of work.
This piece of code works on my iPAQ, but it does NOT work on a Treo 700wx. It retrieves no number on a Treo 700wx. Anybody face the same issue?
Your iPAQ is a pocket pc, and the treo is a smartphone. The smartphone has a two tier security model. ExTAPI is a privileged API, so on a smartphone it can only be run with by a trusted application. The application must be signed with a trusted certificate.
But why is the product specification advertised as "Pocket PC Phone Edition" (see http://www.palm.com/us/products/smartphones/treo700w/specs.html)
The treo 700wx is the US edition? Because the ones that I used in America had Windows Mobile 5.0 Pocket PC edition, however it sounds like a security issue as the guys mentioned above.
Take a look at :
http://msdn.microsoft.com/library/d.../wce51conWindowsMobileDeviceSecurityModel.asp
http://blogs.msdn.com/windowsmobile/archive/2005/11/03/488934.aspx
I signed the app by using the provided privileged certificate in the SDK and it works (in fact I used exTAPI), is worth to try.
Another thing, did you check the CALLERPARTYID flags to ensure that there is a "callerid" after calling getCallInfo?
And one curious thing about the Palms and Verizon, while we developed all in the UK , IMEI numbers are equally formated, in the US for some reason, both Motorola Q and Palm 700w got different formats, same for callerid sometimes, if you are doing any string operation after obtaining the number (like formating, etc,etc) be sure that is not causing any problem.
But my iPAQ is also running WM5 PPC Phone Edition. I believe the code provided above is in fact compatible with many WM5 phone devices, specifically HTC made devices like O2, Dopod, etc.
So is it because Treo 700w has special security level that we need to comply for TAPI to work properly?
Also, commands like lineInitialize, lineOpen, lineGetCallInfo does not return any error. The thing is this... same piece of code, runs on most WM5 PPC, able to retrieve incoming number. But there's just NO incoming number return on a Treo 700w/wx. Any idea?
arsenallad said:
...The treo 700wx is the US edition?...
...Another thing, did you check the CALLERPARTYID flags to ensure that there is a "callerid" after calling getCallInfo?...
Click to expand...
Click to collapse
Yes. Treo 700wx US edition.
No. I use dwCallerIDSize>0.
not sure why it's not working for you, I run simular code on an apache and a iPAQ 6215, works fine. However, I don't think it's a security problem. I was confused by palm calling the treo a smartphone. It has a touch pad, it must be a Pocket PC .
Pocket PC doesn't support the two tier model. Smartphone supports both models. If registry value HKLM\Security\Policies\Policies\0000101b is 0 then the device is two tier otherwise it's one tier. Note 0x101b=4123 so search MSDN for security policy 4123 to find out more.
Plus it's the tapi api that needs to work not exTapi. I don't think any of the tapi functions are privileged.
Just wanted to correct my mistake from yesterday. If you have VS2005 you might want to look at the CallInfo structure in the debuger.
Good luck
WangSN said:
Yes. Treo 700wx US edition.
No. I use dwCallerIDSize>0.
Click to expand...
Click to collapse
dwCallerIDSize it will tell you only the length, if for instance the structure is not properly initialized (as happened to me in this thread) dwCallerIDSize will be zero too, is not a good idea because doesn't give you too much info.
Check in your structure the dwCallerIDFlags member , if returns LINECALLPARTYID_ADDRESS or LINECALLPARTYID_PARTIAL means that callerid is there, now if LINECALLPARTYID_BLOCKED is returned is very likelly that the operator it doesn't have the callerid active or you are calling from a line that protects the "privacy" (whitheld) sometimes is the case, specially in offices that uses PBX.
If LINECALLPARTYID_UNKNOWN is returned, then probably you are having a problem either with the callerid service (the phone does show the callerid when calling?) or somethign to do with your lpcallinfo structure allocation, check that dwTotalSize >= than dwNeeded.
One more thing: It happens to me that after testing using an HP Phone I started testing in a HTC universal phone and it didn't work , particullary in outbound calls, for some reason the LINECALLPARTYID flag returned ADDRESS, but the structure was empty. After trying to discover what was going on, I introduced a small pause in the thread (Sleep) of 2 seconds and worked fine, it seems that hardware can be slow
Good luck.
Nope No luck in getting this to work...
Checked dwCallerIDFlags member, even when value is LINECALLPARTYID_ADDRESS|LINECALLPARTYID_PARTIAL still does not contain the incoming number.
Also tried Sleep for 2 seconds, but still NO number. Before the 2 seconds wait expires, the built-in PPC incoming call dialog already show up WITH caller number.
I'm running out of ideas...
problem solved, post edited...

[idea for an app] Free monthly minutes monitor

Hi, I have an idea for a usefull app, a standalone application for counting call duration. I will use an example on myself. I have a 100 free minutes voice plan from my provider, also 1GB data traffic. The app could have settings to set up the desired minutes amount and it would decrease it by the amount of outgoing calls, and a data transfer counter. Something like Phone Dashboard but not as a Today plugin but standalone program. (LCminute is way too complicated)
I found that US T-mobile has done something similar, called My Account, but where I live there's no such service from T-mobile.
It's just an idea, but i bet many ppl would appreciate it and I bet theres a bunch of ppl here who could do it
yeah something like that would be handy, an application that counts call duration, sms/mms and data usage.
I too would like to see this, any ideas anyone?
Edit: There is a program like this for Nokia users, be great to see something like this for us!
http://dailymobile.se/2008/04/06/symbian-application-freiminmon-free-sms-and-call-counter/
Look for batterystatus, search using the link in my sign.
It give you sms, call time and stuff like that. But it is a today plugin.
cd993: Good though with the sms/mms counter
ai6908: Well as i wrote in the first post, it should be standalone, because i dont wannt to disable TF3D to view the usage, I like the TF3D enviroment (the overkill would be if it could be a separate tab)
no one interested to make such an app? thats a pity
Bump!
Surprised this isn't already out there somewhere. Hate having to run SecondToday or Manila Today Plugin just to run HomeScreen ++, but need to monitor my usage...
My Account
Your best be might be to see if you can modify the T-Mobile My Account app.
I think it is, I used this a while back - see what you think
http://forum.xda-developers.com/showthread.php?t=354103
It's fairly easy to do using Mortscript. I've used one in the past on my Wizard and I've recently been tweaking it to work on this phone. This current iteration is much less complicated/sophisticated than the original version (which I did not write), because I don't want data minutes combined with voice minutes, and I don't care to have my minutes broken down to days and hours for me. And since I have unlimited data I don't need to know how much usage I'm accumulating.
Here's a link to the original thread and script I believe. At any rate it's where I first learned about it 3 years ago. As you'll see the version I've included below is quite different from that one. Between the two of them you just might find what you're after, or perhaps have a good time making one that suits you perfectly.
http://forum.xda-developers.com/showthread.php?t=258960&page=1
Here's what I'm using now. It's written for Mortscript 3.1, which is quite different from his most recent version. Version 4.2 may be backward compatible enough to run this, or it may not. The program allows you to reset your current counters, so if you run it on the day your bill cycle starts fresh and choose Yes to reset it can help you to keep track of where you are for the month.
call getstats
If question {%stats% & "Reset Current?"},"Call Timers"
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,AllCurrent,0
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,AllCurrentNumCalls,0
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,IncomingVoiceCurrent,0
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,IncomingVoiceCurrentNumCalls,0
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,OutgoingVoiceCurrent,0
RegWriteDWord HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0,OutgoingVoiceCurrentNumCalls,0
call getstats
Message %stats%,"Call Timers"
else
exit
endif
sub getstats
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
IncomingVoiceCurrent,minsOnly
call realMinutes
%AllCurrentIncomingMins% = %realMins%
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
OutgoingVoiceCurrent,minsOnly
call realMinutes
%AllCurrentOutgoingMins% = %realMins%
call getRealCurrentMins
%RealCurrentMins% = %returnRealCurrentMins%
###
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
IncomingVoicePhoneLifeTime,minsOnly
call realMinutes
%AllLifetimeIncomingMins% = %realMins%
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
OutgoingVoicePhoneLifeTime,minsOnly
call realMinutes
%AllLifetimeOutgoingMins% = %realMins%
call getRealLifetimeMins
%RealLifetimeMins% = %returnRealLifetimeMins%
###
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
IncomingVoicePhoneLifeTimeNumCalls,numCalls
call tallyCalls
%InVoPhLiTiNumCalls% = %callCount%
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
OutgoingVoicePhoneLifeTimeNumCalls,numCalls
call tallyCalls
%OutVoPhLiTiNumCalls% = %callCount%
call getTotalLifeTimeCalls
%TotalLifeTimeCalls% = %returnTotalLifeTimeCalls%
###
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
IncomingVoiceCurrentNumCalls,numCalls
call tallyCalls
%InVoPhCurrNumCalls% = %callCount%
RegReadDword HKLM,Software\Microsoft\Shell\CumulativeCallTimers\Line_0, \
OutgoingVoiceCurrentNumCalls,numCalls
call tallyCalls
%OutVoPhCurrNumCalls% = %callCount%
call getTotalCurrentCalls
%TotalCurrentCalls% = %returnTotalCurrentCalls%
# There can be no blank lines in the code in the stats section.
%stats% = \
"-->Current Info<--^CR^" & \
"Minutes: " & %RealCurrentMins% & " Rnd'd Up^CR^" & \
" (" & %TotalCurrentCalls% & ") Calls^CR^" & \
"^CR^" & \
"-->Phone Lifetime<--^CR^" & \
"Minutes: " & %RealLifetimeMins% & " Rnd'd Up^CR^" & \
" (" & %TotalLifeTimeCalls% & ") Calls^CR^" & \
"^CR^"
endsub
sub getTotalCurrentCalls
%returnTotalCurrentCalls% = %InVoPhCurrNumCalls% + %OutVoPhCurrNumCalls%
endsub
sub getTotalLifeTimeCalls
%returnTotalLifeTimeCalls% = %InVoPhLiTiNumCalls% + %OutVoPhLiTiNumCalls%
endsub
sub realMinutes
if expression (%minsOnly% = 0)
%realMins% = (%minsOnly%/60)
else
%realMins% = (%minsOnly%/60) +1
EndIf
endsub
sub getRealCurrentMins
%returnRealCurrentMins% = %AllCurrentIncomingMins% + %AllCurrentOutgoingMins%
endsub
sub getRealLifetimeMins
%returnRealLifeTimeMins% = %AllLifetimeIncomingMins% + %AllLifetimeOutgoingMins%
endsub
sub tallyCalls
# Just a way of setting the var to use above.
%callCount% = %numCalls% + 0
endsub
m4xx0rz said:
Your best be might be to see if you can modify the T-Mobile My Account app.
Click to expand...
Click to collapse
My Account is a server based solution, there is no way it would work for any operator other than t-Mo
Need data usage monitoring
Tref said:
It's fairly easy to do using Mortscript. I've used one in the past on my Wizard and I've recently been tweaking it to work on this phone. This current iteration is much less complicated/sophisticated than the original version (which I did not write), because I don't want data minutes combined with voice minutes, and I don't care to have my minutes broken down to days and hours for me. And since I have unlimited data I don't need to know how much usage I'm accumulating.
Here's a link to the original thread and script I believe. At any rate it's where I first learned about it 3 years ago. As you'll see the version I've included below is quite different from that one. Between the two of them you just might find what you're after, or perhaps have a good time making one that suits you perfectly.
http://forum.xda-developers.com/showthread.php?t=258960&page=1
Here's what I'm using now. It's written for Mortscript 3.1, which is quite different from his most recent version. Version 4.2 may be backward compatible enough to run this, or it may not. The program allows you to reset your current counters, so if you run it on the day your bill cycle starts fresh and choose Yes to reset it can help you to keep track of where you are for the month.
Click to expand...
Click to collapse
Yes, I've seen those registry keys and MortScripts to access/reset them to monitor incoming/outgoing minutes used, however what I haven't seen is a way of doing the same thing for data usage, which is what I'm really after. One of the scripts in that thread you referenced allegedly tracks data usage, but uses registry keys that are not present on my device, so obviously that solution doesn't work for me on my Sprint Touch Pro.
Other than monitoring the connections and keeping track of the packets going in and out on that connection, how can I see how much data traffic my phone is using and be able to keep track and reset a counter for monitoring it so I don't go over my 5GB cap?
Sounds like an idea... but I also thought this already existed... Apparently not.
So what would you be looking for?
- Keep track of minutes usage
- Keep track of cellular data usage
- Keep track of your limits and warn if approaching
- Automatic monthly (date configurable) + minutes + data, with optional carry-over ?
Just thinking... anyways, if I would pick up on this project it'd probably have a free beta but end up in the appstore for a few bucks. If
What keys does your phone have in HKLM,Software\Microsoft\Shell\CumulativeCallTimers? If there are none there which appear to be data related, have you searched your Registry for strings containing the word data? I have no idea how Sprint implements their version of WinMo, but it would seen that the registry would have to be employed in one step or another. My Wizard was a Cingular device running WM5, my TP2 an unbranded one and I'm running 6.1. The call timer dwords on both are identical. Why your Sprint is apparently different I have no idea.
Chainfire said:
Sounds like an idea... but I also thought this already existed... Apparently not.
So what would you be looking for?
- Keep track of minutes usage
- Keep track of cellular data usage
- Keep track of your limits and warn if approaching
- Automatic monthly (date configurable) + minutes + data, with optional carry-over ?
Just thinking... anyways, if I would pick up on this project it'd probably have a free beta but end up in the appstore for a few bucks. If
Click to expand...
Click to collapse
I was thinking the morning that it would be nice if I went back into the code I'm running and modify it to ignore nights and weekend minutes/calls and to subtract them from the registry's lifetime entries too. But unless I actually wrote this as a daemon I'd be forced to activate the code after receiving a call under those conditions. Something to think about perhaps....
Yes, please develop this!
Chainfire said:
Sounds like an idea... but I also thought this already existed... Apparently not.
So what would you be looking for?
- Keep track of minutes usage
- Keep track of cellular data usage
- Keep track of your limits and warn if approaching
- Automatic monthly (date configurable) + minutes + data, with optional carry-over ?
Just thinking... anyways, if I would pick up on this project it'd probably have a free beta but end up in the appstore for a few bucks. If
Click to expand...
Click to collapse
Actually, what I'd like is something along the lines of the built in iPhone usage information (see screenshots). Something that shows the cellular network data sent/received (including tethering), the number of SMS in/out and the number of voice minutes used (in categories, e.g., night/weekend, incoming, outgoing, etc., with the ability to select night/weekend hours since they may vary) and the ability to manually or automatically reset the counters at a specific time. Charting or otherwise keeping track of past usage would also be nice.
At the same time, I'm trying out various things to improve my battery usage, so I'd also like to be able to track time phone has been used, time since last full charge, etc., as the iPhone does. Note that I'm not an apple fanboy, I just like this particular app they have that groups together all this info and want something similar for my WM phone!
Really love my Touch Pro, but it's frustrating that getting basic usage info like this is not possible or is difficult to get at the moment. I'd gladly help beta such an app and purchase it once it's ready for release on the WM Marketplace. Had thought of this for my first WM app, but I know others out there could get it done in probably less than 1% of the time it'd take me.
Tref said:
What keys does your phone have in HKLM,Software\Microsoft\Shell\CumulativeCallTimers? If there are none there which appear to be data related, have you searched your Registry for strings containing the word data? I have no idea how Sprint implements their version of WinMo, but it would seen that the registry would have to be employed in one step or another. My Wizard was a Cingular device running WM5, my TP2 an unbranded one and I'm running 6.1. The call timer dwords on both are identical. Why your Sprint is apparently different I have no idea.
Click to expand...
Click to collapse
Not a surprise that Sprint does it differently, just to be difficult!
Here's an export of my Line_0 key:
Code:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\CumulativeCallTimers\Line_0]
"IncomingVoiceCurrentNumCalls"=dword:00000058
"IncomingVoicePhoneLifeTimeNumCalls"=dword:00000058
"IncomingVoiceCurrent"=dword:00003FB8
"IncomingVoicePhoneLifeTime"=dword:00003FB8
"AllCurrentNumCalls"=dword:000000DA
"AllPhoneLifeTimeNumCalls"=dword:000000DA
"AllCurrent"=dword:00008A55
"AllPhoneLifeTime"=dword:00008A55
"LastCallDuration"=dword:0000007F
"OutgoingVoiceCurrentNumCalls"=dword:00000082
"OutgoingVoicePhoneLifeTimeNumCalls"=dword:00000082
"OutgoingVoiceCurrent"=dword:00004A9D
"OutgoingVoicePhoneLifeTime"=dword:00004A9D
"OutgoingDataCustom"=hex:0A,00,00,00,38,93,56,01,F0,54,6E,06,00,00,00,00,01,12,D9,02,00,00,00,\
00,0C,4F,F1,03,00,00,00,00,A9,B5,92,02,00,00,00,00,CE,68,7F,03,00,00,00,00,\
58,5C,46,00,00,00,00,00,3E,E6,71,00,00,00,00,00
"OutgoingSMSCustomIn"=dword:00000013
"OutgoingVoiceCurrentCustom"=dword:0000041E
"OutgoingSMSCustom"=dword:0000000E
"OutgoingSMSCustomFTLow"=dword:13A53080
"OutgoingSMSCustomFTHigh"=dword:01CA697A
"IncomingVoiceDayCustom"=dword:00000135
"OutgoingVoiceDayCustom"=dword:000002B6
"IncomingVoiceCurrentCustom"=dword:00000135
"RoamingCurrentNumCalls"=dword:00000001
"RoamingPhoneLifeTimeNumCalls"=dword:00000001
"RoamingCurrent"=dword:0000002C
"RoamingPhoneLifeTime"=dword:0000002C
Unlike some other devices that have individual keys for incoming/outgoing data, it looks like all that data (no pun intended) is crammed within the OutgoingDataCustom key. Problem is figuring out how to extract it from that key...
You're right on both counts. That is probably the key, and finding out what it means is going to be a problem. Of course Sprint's customer care wouldn't be likely to have a clue. If the folks here don't know, and there is no Sprint TP2-centric forum out there somewhere, then a Sprint Engineer would be the only hope.
I am constantly amazed though at what some of the folks on this board come up with, especially in regards to the registry. How they figure out that tweaking some of these values, which have no apparent similarity to the problem they are trying to fix, will do so is beyond me. So I wouldn't give up hope, and you might just try searching the registry if you haven't already.
Barring a non-Sprint solution, do they have a #611 type number you can call to get a text message back concerning your data usage to date? It's not as handy of course, and nowhere near as cool as an onboard program, but it could save some nasty overage costs.
Something else you might try is to record the values of that key before and after doing some very specific data downloading. It might shed some light on what is happening, especially if you're careful to record the exact amount of time it takes to download a specific amount of data.
Good luck!
App development VB .net
Fellow XDA members,
Im currently busy trying to build a (basic) Minute monitor, based on your personal input in free minutes in a textbox. The output works, but i've yet to get the results from the register.
Only problem is that my programming skills are super basic, so IF it works, it'll work for the Touch Pro 2 (maybe more phone, it should work as long a WM creates the registry values we need).
But any help would be appreciated.
My idea is to make it a free program once ready and working.
So is there anybody who wants/could lend a hand?
For someone with more experience in programming it would be easier.

Android USB Host API: bulk transfer buffer size

EDIT: I know this is not a Q&A forum. However, I couldn't find answer on Stackoverflow and I believe I will find many people here who have faced similar issues before or at least can explain this to me.
I am writing software to communicate between tablet (Motorola Xoom with Android version 4.0.3 and Kernel version 2.6.39.4) and a peripheral device using USB Host API provided by Android. I use only two types of communication:
control - controlTransfer(int requestType, int request, int value, int index, byte[] buffer, int length, int timeout)
bulk - bulkTransfer(UsbEndpoint endpoint, byte[] buffer, int length, int timeout)
Control transfer works fine, but I have a problem with bulk transfer. I can use only 32768 as a size of the buffer for bulkTransfer function. It is not possible to use less or more. I know that I cannot use more because of the limit of the buffer pipe (size: 32769 bytes).
This peripheral device streams data which is not correctly read by bulkTranfer function. I suppose that some data is lost.
I've found information (can't provide outside links at the moment) that: In Linux If a process attempts to read from an empty pipe (buffer), then read(2) will block until data is available. If a process attempts to write to a full pipe , then write(2) blocks until sufficient data has been read from the pipe to allow the write to complete.
And based on that, my explanation of the problem is that some data is not written to pipe (buffer) because of blocking flag made by write(2) function. Am I correct? If this is true I could change pipe buffer.
My first solution for this problem is greater buffer. For kernel >= 2.6.35, you can change the size of a pipe with fcntl(fd, F_SETPIPE_SZ, size) but how can I find fd (file descriptor) for USB pipes?
Second option is to use "ulimit -p SIZE" but parameter p for my kernel is not for pipe but process.
Has anyone faced the same problem, any solutions?

Categories

Resources