[API] HTC HD2 LEO Proximity Api - Windows Mobile Software Development

Use at your OWN risk!!!
Attached C++ class for using proximity sensor.
And small example of using, which printing to debug output changing of proximity status.
Problems:
1. By default when proximity sensor enabled - screen will be switched off when proximity detected. Use method SetAutoScreenOff to disable auto switching off the screen. But when screen switched off and proximity changed from detected => no proximity, screen will be switched on. So you need to disable proximity sensor as soon as you do not want switching screen on when no proximity.
2. Phone Canvas (dialer skin) using same way of enabling proximity sensor, so, if you do not want to interference with dialer use class constructor parameter handleActiveCalls=true
3. maybe something... but don't remember
Using
Create instance of class. Call Enable().
Set proximity detection status changed signaling method:
- with event signaling: SetProximityChangedEvent
- with window message: SetMonitorWindow
To switch off proximity sensor call Disable().
If you found bug or have advice - post here or pm me please.
If somebody creates port to managed code - it's will be nice as i think

exidler said:
Use at your OWN risk!!!
Attached C++ class for using proximity sensor.
And small example of using, which printing to debug output changing of proximity status.
Click to expand...
Click to collapse
Is the code for the LED control also working on other types of phones?
Or is this HTC specific?
Code:
HANDLE hLedDevice = CreateFile(L"LED1:",
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (!hLedDevice || hLedDevice == INVALID_HANDLE_VALUE)
return false;
LEDMGR_CONTROLL ctl;
ctl.p1 = 0; // bit number
ctl.p2 = (autoScreenOffWhenProximityDetected ? 1 : 2); // 2 for set bit else - clear bit
DWORD dwRet;
BOOL bResult = DeviceIoControl(hLedDevice, IOCTL_LEDMGR_SCREENOFF_DISABLEDLED_IOCTL, &ctl, sizeof(ctl),
NULL, 0, &dwRet, NULL);
CloseHandle(hLedDevice);

Have tested on HTC HD2. I think it's HTC specific.

Related

[C#] Screen rotation issue

Hi!
I'm fighting a bug for several hours now... I'm coding a game that needs to be in landscape mode. On the emulator, the HTC Touch Diamond and the HTC Touch HD2 my code works like a charm, but on the HTC Touch HD it doesn't.
In the constructor of the main form I do a
Code:
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation =
Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90;
That does it on the two mentioned phones. But the situation on the other phone is as shown in the image in the attachment.
I already tried to:
PInvoke ChangeDisplaySettingsEx from coredll.dll and set the screen to portrait, then set it to 90° with the above code (Angle90). I tried only to set 90° over ChangeDisplaySettingsEx... and I tried not to rotate the display at all. But it always shows in one of the cases shown in the picture (see attachment).
It kind of seems like that the phone doesn't really change to landscape (only the form does). Like the phone doesn't rotate the display, but only shows the content rotated... how can I fix that?
Thanks!
sepsys
it's just guessing, but do have any rotation tool like gyrator installed on your HD? maybe that comes across...
Obelix_A said:
it's just guessing, but do have any rotation tool like gyrator installed on your HD? maybe that comes across...
Click to expand...
Click to collapse
I'll check it as soon as I, but I don't think so... Someone suggested it could have something to do with the HTC Skin on the mobile that prevents the Screen from rotating. Is that possible? And if yes how can I solve it? The game should also run under those circumstances.
Finally after 2 days:
I need to change the rotation in EVERY frame. Surprisingly it works just fine (even on slower phones).
For others with the same problem:
You should do it only once after first form paint. It works great.
Code:
bool once = true;
private void Form_Paint(object sender, PaintEventArgs e)
{
if (this.once)
{
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation =
Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90;
this.once = false;
}
}

Light sensor -value (lux) or current

Hi. (htc desire android 2.1)
In my app-i'm trying to show on screen values of light (lux) , but i get only few values(0-min 40, 90, 160, 225, 640, 1280-max). Is there oportunity to get much more values between 0 - 1280?? Maybe i use wrong variable. Is there a variable of sensor's current or voltage ?? Can you help me??
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT), sensorManager.SENSOR_DELAY_GAME);
sensorManager.unregisterListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT));
outputX.setText("E:"+Float.toString(event.values[0]));

[Q] Any way to adjust keyboard light brightness?

I'm trying to find out if there's a way to adjust the brightness of the keyboard light and capacitive buttons light. I know it can be done with the galaxy 2 by using extweaks with the siyah kernel. Is there any way to do the same thing with the captivate glide?
yes, look at https://github.com/spyke555/android_device_samsung_i927/blob/master/liblights/lights.c
You can simply
echo 5 >file
Where file one of those:
char const*const PANEL_FILE = "/sys/class/backlight/pwm-backlight/brightness";
char const*const BUTTON_FILE = "/sys/class/misc/melfas_touchkey/brightness";
char const*const KEYBOARD_FILE = "/sys/class/sec/sec_stmpe_bl/backlight";
char const*const NOTIFICATION_FILE_BLN = "/sys/class/misc/backlightnotification/notification_led";
And number is adjustment of the light, I'm not sure witch light support different value.

Tip : S-Pen/Touch Testing The Android way

Thought i'd post this useful hidden feature to test/check your digitizer/s-pen as well as pressure on Note 8 (should likely work for mouse too)
It can be enabled/toggled under Settings > Developer options > Input > Show Pointer location
It will draw cross hairs at your touch location as well as give you some data points.
such as described below
P =1 when touched; Otherwise P=0
dx/dy (delta x, delta y) (offset between location touched and location released, basically drag/stroke offset)
X,Y Screen Co-Ordinates of your touch location (when touched).
Xv/Yv (velocity tracker values for Hori/ Vert resp)
Prs: Pressure Level (0>P<=1 for s-pen, P=1 for finger ) (max pressure i have been able to achieve is around 0.88 that too by adjusting the internal controller inside the s-pen.)
Size: size of your touch region co-ordinate (with finger) value is Zero when using s-pen.
Hope it helps the curious!
for those who want to look into some details , nothing better than the android source code (java) :
https://android.googlesource.com/pl...roid/internal/widget/PointerLocationView.java

Large border around the screen

I have a A505FN with the rom A505FNXXS4BTCA - XEF. I flashed my device with the TWRP patched and the custom splash screen.
It was a success because I'm rooted now, but not whitout problem.
Since I have an important border on my device.
https://zupimages.net/up/20/20/uvwe.jpg
I have for example + 8mm of border on the bottom of the screen..And I can't remove it.
It's an important problem. I restored the rom stock, but the border remained... Could you help me ?
I taped the commande in adb dumpsys display | grep mBaseDisplayInfo
The answer is:
mBaseDisplayInfo=DisplayInfo{"Écran intégré, displayId 0", uniqueId "local:0", app 1080 x 2340, real 1080 x 2340, largest app 1080 x 2340, smallest app 1080 x 2340, mode 1, defaultMode 1, modes [{id=1, width=1080, height=2340, fps=60.000004}], colorMode 0, supportedColorModes [0], hdrCapabilities [email protected], rotation 0, density 420 (403.411 x 404.326) dpi, layerStack 0, appVsyncOff 0, presDeadline 17666666, type BUILT_IN, address {port=0}, state DOZE_SUSPEND, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, removeMode 0}
Thank you
It seems to be normal for me, may it be you had a dark background image before? 8mm including the navigation bar? You can put your phone under some ligth and see the reel edges of the screen, if you see an extra black border then you have a problem .there is ~3mm buttom border in the A50 .
Looks normal to me

Categories

Resources