Related
I was browsing the wiki.xda-developers site and was reading about ShowPin. I noticed that the program assumes 4 digit pins. You can have up to 8 digits according to my XDA. So maybe it would be better to change the code to :-
showpin_pinmsg[12] = showpin_valbuf[0];
showpin_pinmsg[13] = showpin_valbuf[1];
showpin_pinmsg[14] = showpin_valbuf[2];
showpin_pinmsg[15] = showpin_valbuf[3];
showpin_pinmsg[16] = showpin_valbuf[4];
showpin_pinmsg[17] = showpin_valbuf[5];
showpin_pinmsg[18] = showpin_valbuf[6];
showpin_pinmsg[19] = showpin_valbuf[7];
showpin_pinmsg[20] = 0;
Anything less than 8 digits should null terminate itself anyway.
does it work on A.30.09?
I always get error message "Unknown PIN (Error 2)" with my numeric 4-digit PIN.
Any one got it working on XDAI A.30.09?
I only commented on what I think is missing from the source code, I did not write it.
If you look at the source code then a reply of 'Unknown PIN (Error 2)' means that RegQueryValueEx was rejected.
Error 1 means that the registry key HKEY_CURRENT_USER\ControlPanel\PhoneExtendFunction could not be opened and Error 2 means that the value ExtendData could not be read from it.
So I guess that since you don't have error 1 but do get error 2 then you do have the base registry key but have no value ExtendData in it.
You can confirm that using a Registry Editor.
I have no idea why not, maybe it is a Rom Version Issue. It does mean your XDA is a little more secure than others.
I have the A.30.09 ATT ROM... I don't know wether WindowsCE 2003 stores the PIN differently from 2002...
Hi everybody
I tried to achieve a handle for readFile/writeFile operations using lineGetID.
The call to the function passed without errors. My problem is that the handle that I get is 0..., and I should make IO operations some how...
My code:
lRet := lineGetID( FLineHandle, 0, 0, LINECALLSELECT_LINE, PVarString, szClassType );
if lRet = 0 then
begin
FDevHandle := (LPHANDLE(PByte(PVarString) + PVarString^.dwStringOffset ))^;
// some more non relevant code which checks the validity of FDevHandle....
end;
The call to lineGetID is done after successful call to lineGetOpen. I test my application on i-mate jam with WM2003.
Thanks ahead
Kobi
I solved the problem
Hi everybody
For those who encounters the same problem as mine here is the solution that I finally found:
1. The Handle is NULL if we call the lineGetID using LINECALLSELECT_LINE. We should call lineGetID after getting into the LINECALLSTATE_CONNECTED state and use the LINECALLSTATE_CALL parameter. This information was found in the MSDN.
2. The lineGetID (as well as other line functions) doesn't report (I use TAPI 2.0 with WM-2003 on i-mate jam - the cellular line channel) the error LINEERR_STRUCTURETOOSMALL, so immediately after calling the lineGetID I added the following line (I use free pascal compiler):
if (Result = 0) and (PVarString^.dwTotalSize < PVarString^.dwNeededSize) then
Result := integer(LINEERR_STRUCTURETOOSMALL);
After this line comes the characteristic TAPI code which checks if either we should reallocate the previous block, or we can already use the data that call should have given to us.
Just after considering these 2 issues I got a vaild Handle...
Kobi
Hi Kobi,
I also having difficulties creating handle to write data on this TAPI Line, Can you please help me translate your code in VB.NET or C#, I am using VB and C# on developing application in WM2003.
Many thanks in Advance,
Eefendi
More complete code
Hi Eefendi
I neither know VB.NET nor C#, so it will be in Pascal, but I will add comments.
The code itself should be activated after you received the LINE_CALLSTATECONNECTED message/event (depends on the mechanism you selected when you called lineInitialize).
The CallHandle is a variable holds the handle of the call you want to achieve a handle to its stream (you achieve CallHandle, in incoming call for example, using LINE_CALLSTATEOFFERING message/event). The final result we want is stored in Handle. The line itself should be opened using "comm" or "comm/datamodem" class type.
var
VarSize,
Res : integer;
PVarString : LPVARSTRING;
szClassType : PWideChar = 'comm/datamodem';
// these variables definitions is equivalent to the following C code:
// int VarSize, Res;
// LPVARSTRING PVarString;
// TCHAR *szClassType = "comm/datamodem";
begin
VarSize := sizeof(VARSTRING);
Handle := 0;
repeat
GetMem( PVarString, VarSize ); // alloc VarSize bytes
PVarString^.TotalSize := VarSize;
Res := lineGetID( 0, 0, CallHandle, LINECALLSELECT_CALL, PVarString, szClassType );
if (Res = 0) and (PVarString^.TotalSize < PVarString^.NeededSize) then
Res := LINEERR_STRUCTURETOOSMALL;
if Res = LINEERR_STRUCTURETOOSMALL then
VarSize := PVarString^.NeededSize
else
if Res = 0 then // no error
Handle := LPHANDLE(PByte(PVarString) + PVarString^.dwStringOffset)^;
FreeMem( PVarString, PVarString^.TotalSize ); // free memory
until Res <> LINEERR_STRUCTURETOOSMALL; // finish the repeat until loop if this condition is TRUE
if (Handle <> 0) and (Handle <> INVALID_HANDLE_VALUE) then
//;use it as you wish....
end;
Some help to you for conversion:
1. PVarString^.TotalSize using C means PVarString->TotalSize
2. PByte using C means char*
3. type cast for example to PByte is done by PByte(...) while using C it is done by (PByte)...
4. Refering to a value which is referenced by the pointer P and storing it in variable X is done by "X := P^;". using C it is done by "X = *P;".
5. The operator <> means not equal. in C it is !=.
I hope it will be easy to you to translate it to C or any other language you want.
Good luck with your project.
Kobi
TAPI does seem to pop up a lot.
Have you looked at my code I posted a while back here ?
http://forum.xda-developers.com/viewtopic.php?t=18978
Hi Vangelderp and Kobi,
thanks for spending your time answering my questions and also thanks for the code provided. I use VB.Net 2003 on programming my pocket PC 2003, you guys provide me the code using pointer data type which is not supported in VB.net, so I am having trouble converting it. ( When I was learning C++, pointer is always make me confuse :roll: ). I wish you guys will be kind enough helping me convert it to VB.Net, just for small part to get Handle. :wink:
Mant Thanks in advance,
Eefendi
Hello Everyone
I hope this is not too trivial a question. I am new to eVC. I would like to know how to convert from data type LONG to data type CHAR OR STRING in eVC.
Long myLong=1134.67
In VB the conversion will simply be
myString=STR(myLong)
How can I achieve this in eVC++?
Also someone please recommend some good books on eVC++.
Thanks.
ajanaman
evc++ is just like vc++
which is just like c++ with mfc on top of it
to do simple type casts you do
x=(Type)y;
here are some links also included dynamic type casts
http://www.cplusplus.com/doc/tutorial/typecasting.html
http://www.torjo.com/win32gui/doc/window_casting.html
Hello gsmtexts!
First I would like to point out that in C++ LONG data type is a 4 byte signed integer (in your example you use a floating point value).
Second I assume that by converting you mean representing the number as a string of characters an not just letting the computer assume that the variable contains ASCII values instead of a number.
Here's how you do it:
C++ language doesn't have string data type instead you use an array of char.
Example:
Code:
char myStr[255]; //you have a string of up to 255 ASCII chars.
double myVal = 50.1234; //a double precision floating point value
_gcvt(myVal, 6, myStr); //convert the string
You could use one of the functions (you can search the MSDN site for more details): _gcvt, _ecvt, _fcvt, but there is a simpler way as well:
Code:
WCHAR myStr[255]; //win CE works with Unicode strings.
float myVal = 1.2345; //the value
swprintf(myStr, L"The value: %f", myVal); //creates a string: 'The value: 1.2345'
Finally if you are using MFC:
Code:
CString str;
float myVal = 1.2345;
str.Format(_T("The value: %f"), myVal);
As for books I can only recommend "Teach yourself C++", by Jesse Liberty, it got me started in C++ programming.
Good luck.
Dear levenum
many thanks - I have sratched my head for nearly a week and you gave me the solution just like that. _gcvt did it. u are a wonderful guru.
ajanaman
You are welcome gsmtexts!
But I am far from being a guru. I just like programming so I picked up a book or two and the ball started rolling. 8)
Anyway, since you chose to use _gcvt you should know that in order to use the string you get with windows API's like SetWindowText you will have to convert it to Unicode:
Code:
WCHAR uniBuffer[50]; //Unicode buffer
char myString[50]; //ASCII buffer
_gcvt(1.2345, 5, myString); //convert value to string
mbstowcs(uniBuffer, myString, 50); //convert ASCII string to Unicode
The standard c++ way would be:
double d=122.332;
std:stringstream oss;
oss << d;
std::string mystring=oss.str();
The standard c++ way would be:
double d=122.332;
std:stringstream oss;
oss << d;
std::string mystring=oss.str();
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
Hey Guys!
I need a little help in Sql Database programming in vb.net!
how can i Connect to 2 Databases and Join their queries?
Code:
Dim SQLcon As SqlCeConnection = Nothing
Dim strPDAPfad As String = AppDir & "\Catalogs\" & Config.QuestionFileName
Const strPDAPasswort As String = ""
SQLcon = New SqlCeConnection("Data Source=" & strPDAPfad & ";" & strPDAPasswort)
SQLcon.Open()
Dim SQLString As String = "SELECT * FROM QUESTIONS WHERE ID = '" & QuestionID & "'"
Dim SQLQuery As SqlCeCommand = New SqlCeCommand(SQLString, SQLcon)
i want to join 2 databases so i can order one table with the help of another!
Just Like I would have one Database with 2 Tables
"SELECT Questions.ID FROM Questions ORDER BY Stats.Wrong DESC"
I think this is not possible to to it directly. You might need to load the data of one into a temp table in the other db and then do the query.
Would be bad I need to do this very often
I will try to find out how to attach both files to an SQL Compact server and try that again
[edit] found nothing!
scilor said:
Hey Guys!
I need a little help in Sql Database programming in vb.net!
how can i Connect to 2 Databases and Join their queries?
Code:
Dim SQLcon As SqlCeConnection = Nothing
Dim strPDAPfad As String = AppDir & "\Catalogs\" & Config.QuestionFileName
Const strPDAPasswort As String = ""
SQLcon = New SqlCeConnection("Data Source=" & strPDAPfad & ";" & strPDAPasswort)
SQLcon.Open()
Dim SQLString As String = "SELECT * FROM QUESTIONS WHERE ID = '" & QuestionID & "'"
Dim SQLQuery As SqlCeCommand = New SqlCeCommand(SQLString, SQLcon)
i want to join 2 databases so i can order one table with the help of another!
Just Like I would have one Database with 2 Tables
"SELECT Questions.ID FROM Questions ORDER BY Stats.Wrong DESC"
Click to expand...
Click to collapse
Dim SQLString As String = "SELECT * FROM tbl1, tbl2 WHERE tbl1.ID = tbl2.ID and tbl1.QuestionID = '" & QuestionID & "'"
Thank you But I want to do this out of 2 Databases not out of 2 Tables!
I have not actually had the need to do so.
But I would check out LINQ, I have a feeling it should be able to do that.
I'll check it for you when I get home (at work at the moment).
LINQ how it works? I only find rare information for it!
how can I use it in VB.net 2008 ?
There is SQL Command named
UNION
which can Combined Identical Structure Database to Combine the Record from Both Table have you tried it
But how can I use that practically, i know in php is that easily because I know the alias of the Database but with my technic
New SqlCeCommand(SQLString, SQLcon)
there only can be one Database Per Connection
LINQ will read all the records from both databases into memory then do the merge join and give you the matched resultset. You could probably do it much better yourself. If you are going to repeat this join often, then for the sake of the user's patience, you should at least try to do it yourself.
If one table is known to be smaller (in KB) than the other, then I would cache that table in a Dictionary<keyColumn, DataRow> construct. Then I would open a data reader on the second table and process each of those rows by referring to the cached version of the first table.
Of course, I assume you have already ruled out the possibility of permanently merging the two databases? That would be the best solution. But perhaps there are two separate applications, to which you do not have the source code, responsible for maintaining these two databases, in which case I fully understand.
I need to Seperate both!
It is for my Driving Licence Trainer. and I want to Seperate Training Files from the Statistics
If one table is known to be smaller (in KB) than the other, then I would cache that table in a Dictionary<keyColumn, DataRow> construct. Then I would open a data reader on the second table and process each of those rows by referring to the cached version of the first table.
Click to expand...
Click to collapse
@ftruter Could you make an Example for using it for sorting?