I can draw polygons with canvas.drawVertices, but I can not fill them. I have set Paint.Style.FILL on the paint object,but the polygon doesn't get filled. Why doesn't the polygon get filled? This is my code:
mLinePaint2 = new Paint();
mLinePaint2.setARGB(255, 255, 0, 0);
mLinePaint2.setStyle(Paint.Style.FILL);
canvas.drawVertices(Canvas.VertexMode.TRIANGLES, verts.length, verts, 0, null, 0, null, 0, null, 0, 0, mLinePaint2);
Related
Ok so here's the deal , i wrote a eVB program as a hyperTerminal to send AT commands as described in the forum. However my ATD commands do not work , would somebody be kind enough to show me how its done in eVC, how to open the port and send a command to it as well as retrieve the information from it.
Thanks to you all !!!!!!
hComm = CreateFile(L"COM2:", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
if (hComm == NULL || hComm == INVALID_HANDLE_VALUE)
{
hComm = NULL;
return false;
}
hRil = CreateFile(L"RIL1:", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
if (hRil == NULL || hRil == INVALID_HANDLE_VALUE)
{
hRil = NULL;
return false;
}
memset (&siomode, 0, sizeof (DCB));
siomode.DCBlength = sizeof (DCB);
siomode.BaudRate = CBR_115200;
siomode.fBinary = FALSE;
siomode.fParity = FALSE;
siomode.fOutxCtsFlow = FALSE;
siomode.fOutxDsrFlow = FALSE; /////////////////////////////////////////////////////////////////////////
siomode.fDtrControl = DTR_CONTROL_DISABLE;
siomode.fDsrSensitivity = FALSE;
siomode.fTXContinueOnXoff = TRUE;
siomode.fOutX = FALSE;
siomode.fInX = FALSE;
siomode.fErrorChar = FALSE;
siomode.fNull = FALSE;
siomode.fRtsControl = RTS_CONTROL_ENABLE;
siomode.fAbortOnError = FALSE;
siomode.XonLim = 512;
siomode.XoffLim = 128;
siomode.ByteSize = 8;
siomode.Parity = NOPARITY;
siomode.StopBits = ONESTOPBIT;
siomode.XonChar = 0x11;
siomode.XoffChar = 0x13;
siomode.ErrorChar = 0x0D;
siomode.EofChar = 0x0D;
siomode.EvtChar = 0x0D;
if (!SetCommState(hComm, &siomode))
{
return false;
}
if (!EscapeCommFunction(hComm, SETDTR))
{
return false;
}
if (!GetCommTimeouts(hComm, &to))
{
return false;
}
to.ReadIntervalTimeout = 0;
to.ReadTotalTimeoutConstant = 200;
to.ReadTotalTimeoutMultiplier = 0;
to.WriteTotalTimeoutConstant = 20000;
to.WriteTotalTimeoutMultiplier = 0;
if (!SetCommTimeouts(hComm, &to))
{
return false;
}
if (!SetCommMask(hComm, EV_RXCHAR))
{
return false;
}
DWORD rildevresult = 0, nReturned = 0;
DeviceIoControl(hRil, 0x03000314L, 0, 0, &rildevresult, sizeof(DWORD), &nReturned, 0);
if (!DeviceIoControl (hComm, 0xAAAA5679L, comdevcmd, sizeof(comdevcmd), 0, 0, 0, 0))
{
return false;
}
WriteFile(hComm, "ATE1Q0V1S0=0;+CFUN=1;+CREG=0\r", 29, &i, NULL);
return true;
I had a chat with technical ppl from my Network , and they tell me that if my ATD commands arn't working its because i need to specify CSD (circuit switch data) or GPRS. Now ofcourse i asked them how to do that ? They could not come up with an answer, so i am asking you guys. What set of AT commands would allow you to set up as CSD and not GPRS ??
Tech guys -> i wonder were they get recruited they dont even know how to use AT commands !!!!!!
Cheers for all your helps !!!!
Dial
ATDxxxx will set up CSD data call
ATDxxxx; will set up voice call.
For GPRS, you have to use a serial of CGD commands to attach to the network and set up context.
- David
ATD"0123456789";
Click to expand...
Click to collapse
Would you send an ATD from your XDA2 in this format ?? it seemed to do the trick for me. However now it doesnt work anymore ... weird i think my modem' settings could be ****ed up.
No double quotes.
ATD"0123456789";
should be
ATD0123456789;
- David
Alright then thanks. However it still doesnt work. I get an OK back then a NO CARRIER message.
Would anybody know how that can be ? I'm guessing it could be hardware issues with the PDA. Maybe i'm missing some kind of setup. As in a particular AT command to tell the modem that it is ment to be doing a CSD connection or something like that.
Thanks for your help.
cheers
1)maybe modem in autoanswer mode, try ATS0=0
2)maybe some program drop your call
I managed to get it working, for some reason my application in eVB did not work but once implemented in eVC it did. Strange ? I need a bit more clarification on how to retrieve data, i have tried some trial and errors method. Cou;ld someone help me out and check this post out. Thanks.
http://forum.xda-developers.com/viewtopic.php?t=16204
Does someone know this? I want to unregister from the GSM network, but not enter the flightmode (I still need SIM access, and it should be fast). The following code works fine on a S100 (WM2003), but the 9100 (WM5) refuses to unregister. Registering works fine on both devices.
Code:
GsmControl::GsmControl()
{
errorMsg = TEXT("No ERROR/SUCCESS message to display.");
hLineApp = NULL;
hLine = NULL;
LineInitializeExParams.dwTotalSize = sizeof(LineInitializeExParams);
LineInitializeExParams.dwNeededSize = 0;
LineInitializeExParams.dwUsedSize = 0;
LineInitializeExParams.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
LineInitializeExParams.Handles.hEvent = NULL;
LineInitializeExParams.dwCompletionKey = 0;
dwLineAPIVersion = TAPI_CURRENT_VERSION;
GsmInitialize();
}
HRESULT GsmControl::GsmInitialize()
// Initializes TAPI interface
{
res = lineInitializeEx(&hLineApp, NULL, NULL, NULL, &dwNumDevs, &dwLineAPIVersion, &LineInitializeExParams);
res = lineOpen(hLineApp, 0, &hLine, dwLineAPIVersion, 0, 0, LINECALLPRIVILEGE_MONITOR, 0, NULL);
return res;
}
HRESULT GsmControl::GsmLineUnregister()
{
res = lineUnregister(hLine);
// res = lineSetEquipmentState(hLine, LINEEQUIPSTATE_NOTXRX); /* Edit: This is commented out, as I don't want any kind of flightmode behaviour */
return res;
}
HRESULT GsmControl::GsmLineRegister()
{
// lineSetEquipmentState(hLine, LINEEQUIPSTATE_FULL); /* Edit: This is commented out, as I don't want any kind of flightmode behaviour */
res = lineRegister(hLine, LINEREGMODE_AUTOMATIC, NULL, 0);
if ( res != 0 ) //FAILED(res) )
{
errorMsg = TEXT("ERROR GsmLineRegister - lineRegister\n");
} else {
errorMsg = TEXT("SUCCESS GsmLineRegister - lineRegister");
}
return res;
}
Whats the return value of the lineUnregister() call?
Sorry, I have a problem getting the value. It's larger than zero.
Shouldn't the following code open a message window that says "GsmLineUnregister returned X"?
Code:
LPTSTR lpText = new WCHAR[1024];
swprintf(lpText, TEXT("GsmLineUnregister returned $d"), gsmCtrl->GsmLineUnregister());
MessageBox(NULL, lpText, TEXT("Deva Daemon"), MB_ICONINFORMATION);
Edit: I'm making too many mistakes lately. I also commented out lineSetEquipmentState, as that's how I want it to work but it doesn't (on a 9100)
OK, I've got it now. lineUnregister returns '11'.
Edit: It's not stable, it seems to return quite all kinds of values larger than ten. Each value is larger than its predecessor. After a reboot, I got a 12, and then again increasing numbers (19, 25, 29, 31). It doesn't seem to make any sense.
(Will I ever manage to write a post with no edits this week?)
Hi. I am trying to select programatically a today theme. I ve found different examples and I am using this function:
Code:
BOOL LoadTheme(LPCTSTR pszThemeFile)
{
HKEY hKey;
LONG lRet;
TCHAR szCmdLine[MAX_PATH];
PROCESS_INFORMATION pi;
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0,
0, &hKey);
if(ERROR_SUCCESS == lRet) {
RegDeleteValue(hKey, _T("UseStartImage"));
_stprintf(szCmdLine,_T("/safe /noui /nouninstall /delete 0 \"%s\""),
pszThemeFile);
if(CreateProcess(_T("\\Windows\\wceload.exe"), szCmdLine, NULL, NULL,
FALSE, 0, NULL, NULL, NULL, &pi)) {
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)pszThemeFile,
sizeof(TCHAR) * (_tcsclen(pszThemeFile) + 1));
RegFlushKey(hKey);
}
RegCloseKey(hKey);
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
::SendMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0);
}
return (ERROR_SUCCESS == lRet);
}
Then I see how the background image changes, as color fonts but upper and lower bars, and scrooll bars doesnt change. Any idea? Thanks
Dani
Hi.
If a reset then It works. It seems the last postmessage dont do their job correctly. Any idea?
Ive noticed this just manually changing the theme, the keyboard icon background changes as expected, but the top and bottom bar do not, change it again and it works, although now im on a theme i dont want, so have to change again
The question is as follows. Write a utility that when you start with the parameters governing the brightness of the screen.
For example
backlight.exe-up / / brightness, plus 1 point
backlight.exe-down / / brightness minus 1 point
Found in the forum code for the proposed Sorg'om PhoneAlarm, may help:
Code:
int batt = 5; //яркость от батареи 0...7
int ext = 7; //яркость от внешнего источника 0...7
HANDLE h = CreateFile(L"BKL1:", GENERIC_READ, 0, 0, 0, 0, 0);
if(h)
{
BYTE InBuf[8] = {2, 0, 0, 0, 0, 0, 0, 0};
DWORD Res = 0;
if(batt>7) batt = 7;
if(ext>7) ext = 7;
if(batt>=0)
{
HKEY key;
if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"ControlPanel\\AsusSettings\\Backlight", 0, 0, &key))
{
RegSetValueEx(key, L"BatteryPower", 0, REG_DWORD, (BYTE*)&batt, 4);
RegCloseKey(key);
}
InBuf[4] = batt;
InBuf[6] = 0;
DeviceIoControl(h, 0xA201A004, InBuf, 8, NULL, 0, &Res, NULL);
}
if(ext>=0)
{
HKEY key;
if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"ControlPanel\\AsusSettings\\Backlight", 0, 0, &key))
{
RegSetValueEx(key, L"ExternalPower", 0, REG_DWORD, (BYTE*)&ext, 4);
RegCloseKey(key);
}
InBuf[4] = ext;
InBuf[6] = 1;
DeviceIoControl(h, 0xA201A004, InBuf, 8, NULL, 0, &Res, NULL);
}
CloseHandle(h);
}
Driving should only illumination from the batteries.
All this is necessary to control it from WisbarAdvanced Desktop.
In programming, I am a bit up my street, but not that much ... therefore, care and ask.
Translated from Russian by Google.
The code below draws my png images. Now I want to get left_btn clickable. When you click on the image left_btn should left_foot be hidden and another png image appear. How do you make these? I am not useing layout -> main.xml
Code:
public class DrawView extends View implements OnClickListener {
private ColorBall game, left_btn, right_btn, head_body, left_foot, right_foot, left_arm, right_arm, left_hand, right_hand;
public DrawView(Context context) {
super(context);
setFocusable(true); //not yet necessary, but you never know what the future brings
// declare each ball with the ColorBall class
game = new ColorBall(context,R.drawable.test1);
left_btn = new ColorBall(context,R.drawable.left_btn);
right_btn = new ColorBall(context,R.drawable.right_btn);
head_body = new ColorBall(context,R.drawable.head_body);
left_foot = new ColorBall(context,R.drawable.left_foot);
right_foot = new ColorBall(context,R.drawable.right_foot);
left_arm = new ColorBall(context,R.drawable.left_arm);
right_arm = new ColorBall(context,R.drawable.right_arm);
left_hand = new ColorBall(context,R.drawable.left_hand);
right_hand = new ColorBall(context,R.drawable.right_hand);
}
@Override protected void onDraw(Canvas canvas) {
canvas.drawBitmap(game.getBitmap(), 0, 0, null);
canvas.drawBitmap(left_btn.getBitmap(), 45, 206, null);
canvas.drawBitmap(right_btn.getBitmap(), 397, 206, null);
canvas.drawBitmap(head_body.getBitmap(), 230, 132, null);
canvas.drawBitmap(left_foot.getBitmap(), 225, 185, null);
canvas.drawBitmap(right_foot.getBitmap(), 250, 185, null);
canvas.drawBitmap(left_arm.getBitmap(), 205, 165, null);
canvas.drawBitmap(right_arm.getBitmap(), 260, 165, null);
canvas.drawBitmap(left_hand.getBitmap(), 190, 145, null);
canvas.drawBitmap(right_hand.getBitmap(), 290, 145, null);
invalidate();
}
Set an OnClickListener on left_btn and set a variable to true so you draw the original if false or the replacement if true. Also, why are you calling invalidate in onDraw()? Invalidate will force a redraw. Generally you don't want that until something changes that requires a redraw.