I'm working on my code to keep GPS alive (today screen plugin, dunno if anyone ever posted it here but it's over at ppcgeeks). Turns out the qualcomm driver for the GPS in the Mogul crashes if the device goes to sleep when there is an open handle to the GPS device.
I did some quick hacking with SetPowerRequirement and it turns out the driver ignores power requirements.
At this point, my conclusions lead me to be pretty upset with HTC for once again passing ****ty drivers on to us. So I go to my last resort option, using RequestPowerNotifications. Spent a few hours debugging and getting the message loop working correctly, only to find out the PBT_TRANSITION message for suspension doesn't always come through before the device goes down.
Does anyone have any ideas on how to handle GPS and Sleep? I'd hate to do something to totally change the functioning of the device (like holding the whole device alive), but I can't really think of anything else to do.
Hi, did you already found solution ?
Hi Baffles, I haven't documented this yet, I will soon...
In GpsGate v2.6.0.308, they added an "WM GPS" option for the "Input" source. When this is done then GpsGate primes the GPS on the Titan. Also when used in conjunction with the "Close input when idle" option in the "Advanced" section of the "Input" tab in GpsGate, then GpsGate only turns on the GPS when a GPS application request GPS data from the GpsGate output port. This behavior seems to survive suspend/wakeup just fine too. Maybe you can study how they handle it as a clue for your application.
Hi
I am having exactly the same problem myself, especially with the TyTnII, have you had any luck?
Thanks
Dan
It took me a while, but on the end I got it to work...
Point is that you have to use Unattended mode
here is what you have to do:
1) call PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)
this will tell to PowerManager that your application wants to do something before device go to sleep - will activate Unattended mode
2) SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);
not sure if this is needed, but because we need GPS to stay alive it is ok to call it (if you use GPS over COM port, instead of GPS0: should be COMx
3) use RequestPowerNotifications(m_hMsgQueue, PBT_TRANSITION)
and create MessageQueue to get info when mode is changed... (look e.g. POWER_BROADCAST structure for more info).
4) you have to have one WaitForSingle/MultipleObjects with timeout, where you will wait for handle on MessageQueue you created for PBT_TRANSITION
5) when PBT_TRANSITION comes, and if device is changed in Unattended mode (simple string comparing POWER_BROADCAST.SystemPowerState=="unattended") you are responsible to keep device alive.. which mean you have to call periodically SystemIdleTimerReset() - if you do not do that, your device will go to sleep mode
do not call SystemIdleTimerReset() if you are not in unattended mode, because that will prevent device to switch off backlight and screen.
6) in case of timeout on WaitForXXObjects you can read GPS port and process your data
.. in general Unattended mode needs more power then sleep mode, but that is only way (at least on my HTC Artemis).
From documentation point of view simple call SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL) should be enough, but it is not so
I hope that will help you... my application works fine now and I'm happy
regards,
Igor
Thanks for that Igor, that all works for me as well. Tested on HTC P3300 and HTC P3600. I have also tried this on the HTC TyTnII but that deviceas always doesn't want to play nicely, as Baffles pointed out it does indeed seem to ignore calls to SetPowerRequirement.
If anyone has come across a way getting round the problems of the TyTnII, it would be great to hear it.
Thanks
Dan
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.
I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.
I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?
Please help me out!
same problem on P3650
Hi there,
I have the same problem on the HTC Polaris (P3650). I want to run my application in unattended mode with an open gps connection.... and I haven'T found a solution yet.
Could anyone who managed to do that pleas post a code example for that.
Thanks a lot.
Patrick
negerzoen said:
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.
I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.
I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?
Please help me out!
Click to expand...
Click to collapse
Hi, sorry for late answer....
In transition event you just need SystemIdleTimerReset.. basically that is what unattended mode is:
In Unattended mode.. you get transition event PBT_TRANSITION, where SystemPowerState is "unattended", and application can decide if will allow device to go to sleep or to call SystemIdleTimerReset...
I'm not sure how long "unattended" PowerState stays... but if you call often SysteIdleTimerReset, your app could work without MessageQueue (anyway I use message queue for monitoring power state, and if power is to low, I switch off GPS device).
here is my code snippet - it is not guaranteed that is compilable, because I took parts from my application.... but should be enough to get overview what you have to do to make it to work.
About managed code.. I didn't try it.. somehow for me is still easier to write C++ code
Code:
static const DWORD maxMsgQueueMsgSize = sizeof(POWER_BROADCAST_POWER_INFO) + sizeof(POWER_BROADCAST) + MAX_PATH;
// create stop event
HANDLE hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
// create event for GPS change
HANDLE hDeviceStateChanged = CreateEvent(NULL, FALSE, FALSE, NULL);
// Create message queue
MSGQUEUEOPTIONS msgQueueOptions;
ZeroMemory(&msgQueueOptions, sizeof(msgQueueOptions));
msgQueueOptions.dwSize = sizeof(msgQueueOptions);
msgQueueOptions.dwFlags = MSGQUEUE_NOPRECOMMIT ;
msgQueueOptions.cbMaxMessage = maxMsgQueueMsgSize;
msgQueueOptions.bReadAccess = TRUE;
HANDLE hMsgQueue = ::CreateMsgQueue(NULL, &msgQueueOptions);
HANDLE hPowerNotification = ::RequestPowerNotifications(hMsgQueue, PBT_POWERINFOCHANGE | PBT_TRANSITION);
// opening GPS device
HANDLE hGPSDevice = ::GPSOpenDevice( 0, hDeviceStateChanged, NULL, 0);
bool bRun = true; // run loop
bool bHasSignal = false;
// change power requirement for GPS device and SD card
HANDLE hGPSPowerReq = ::SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);
HANDLE hPowerReq = ::SetPowerRequirement(L"DSK1:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);
// change to Unattended mode
::PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);
// LOOOP
HANDLE events[3] = {hDeviceStateChanged, hStopEvent, hMsgQueue} ;
while (bRun)
{
DWORD dwWaitRes = ::WaitForMultipleObjects(3, events, FALSE, 1000 ); // read every 1. sec.
switch (dwWaitRes)
{
case WAIT_OBJECT_0:
// device status changed
{
GPS_DEVICE dev;
ZeroMemory(&dev, sizeof(dev));
dev.dwVersion = GPS_VERSION_1;
if (ERROR_SUCCESS == ::GPSGetDeviceState(&dev))
{
// do something...
}
}
break;
case WAIT_OBJECT_0+1:
// exit requested from exit event.. this is done from other thread by calling SetEvent(hExitEvent)
bRun = false;
break;
case WAIT_OBJECT_0+2:
// if we are on low power, stop monitoring
{
// there is a message in EventQueue.. read queue
BYTE buffer[maxMsgQueueMsgSize];
DWORD NumberOfBytesRead = 0;
ZeroMemory(buffer, maxMsgQueueMsgSize);
DWORD dwFlags;
if (::ReadMsgQueue(m_hMsgQueue, buffer, maxMsgQueueMsgSize,&NumberOfBytesRead, 0, &dwFlags ) && NumberOfBytesRead>=sizeof(POWER_BROADCAST))
{
POWER_BROADCAST* pPwrBrodcast = (POWER_BROADCAST*)(buffer);
switch(pPwrBrodcast->Message)
{
case PBT_POWERINFOCHANGE:
{
// if battery level is to low, finish with GPS reading
POWER_BROADCAST_POWER_INFO* pPowerInfo = (POWER_BROADCAST_POWER_INFO*)pPwrBrodcast->SystemPowerState;
if ((pPowerInfo->bBatteryFlag==2 || pPowerInfo->bBatteryFlag==4) && (pPowerInfo->bACLineStatus==0))
bRun = false;
}
break;
case PBT_TRANSITION:
{
std::wstring powerState = pPwrBrodcast->SystemPowerState;
// handle power states
if (powerState==L"resuming")
::PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE); // basicaly should never happen, because we do not allow to go in
if (powerState==L"unattended")
SystemIdleTimerReset();
}
break;
default:
ASSERT(!"Unknown message");
}
}
break;
case WAIT_TIMEOUT:
// new location
break;
}
// DO SOMETHING... e.g. Read position from GPS PORT
}
// ENDLOOP
::PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE); // Leave unattended mode
::ReleasePowerRequirement(hGPSPowerReq); // allow GPS device to go in sleep
::ReleasePowerRequirement(hPowerReq);
::GPSCloseDevice(hGPSDevice); // close GPS device
StopPowerNotifications(hPowerNotification);
CloseMsgQueue(hMsgQueue);
CloseHandle(hPowerNotification);
CloseHandle(hMsgQueue);
negerzoen said:
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.
I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.
I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?
Please help me out!
Click to expand...
Click to collapse
Just one more thing (or two)...
you read from COM9.. maybe you should try to call
SetPowerRequirement(L"COM9:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);
in case that you press Power button.. device is going immediately into Unattended mode, and there is chance to miss that mode in case that you do not have MessageQueue, or maybe there is some kind of Windows optimization that if no applications are registered for PBT_TRANSITION, Unattended mode is skipped and device going immediately into Sleep.
You wrote that "there are no more data to read from COM port".. are you sure that your code is running?
in case that your code is still running, then you prevented Sleep mode, and you have to find correct call to SetPowerRequrement. But; if your code is stopped, then your device is sleeping, and you have missed Unattended mode.
I hope that will help a bit....
for those of us that don't know anything about code, is this something that can be cabbed?
fredcatsmommy said:
for those of us that don't know anything about code, is this something that can be cabbed?
Click to expand...
Click to collapse
not really.. except that you want to have application which prevents your device to go into sleep mode...
Unfortunately I have not so much time to finish my application, but when that is finished.. I will post here link (and .cab) for sure...
Hi, been a member for a while and don't remember if i posted yet or not, I was coming up against this problem when developing a GPS application on a HTC TYTN2,
I wanted to constanty record the gps position, but not keep the screen on all the time,
I got around the sleep function of the device by not letting it into the suspend mode and keeping it in the unattended mode. this was done by calling:
PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)
This put the lowest state the PPc could go into is the unattended mode but when it went into this mode the gps still turened off,
From reading an article on the code Project, : http://www.codeproject.com/KB/mobile/WiMoPower1.aspx i seen that different power levels ( i mean suspend etc here cant remember the poper term), turn off different applications and these are controlled via registry entries found here for the unatteneded mode :
HKEY_LOCAL_MACHINE\System\\CurrentControlSet\\Control\\Power\\State\\Unattended
the values that controls the GPS Intermediate Driver is "gpd0:" you change this to a 0 to keep GPS on in unatteneded mode, and 4 for it to be off in unattended mode,
I change it when my application starts and change it back when it finishes,
The GPS is kept alive using the "gpd0:" name, not "gps0:".
So, when your application starts call (C#):
public const int PPN_UNATTENDEDMODE = 0x0003;
public const int POWER_NAME = 0x00000001;
public const int POWER_FORCE = 0x00001000;
PowerPolicyNotify( PPN_UNATTENDEDMODE, 1 ); // For app.
IntPtr GpsPowerHandle = SetPowerRequirement( "gpd0:", PowerState.FULL /* 0 */, POWER_NAME | POWER_FORCE, IntPtr.Zero, 0 ); // For GPS.
When your application stops call:
ReleasePowerRequirement( GpsPowerHandle );
PowerPolicyNotify( PPN_UNATTENDEDMODE, 0 );
Nothing else is necessary. Works on my Polaris.
In the attached app, you need to set "MainForm.KeepGpsAlive = true"and "MainForm.LogGps = true" to see this logged in "\Application Data\GpsLoc".
(You can use the compiled exe but without keep alive and logging. It can be used to send the position through SMS and sync the time.)
George
This is an update of the code. The previous one was crashing sometimes because the GPS reported a (cached) solution but there were no satellites in the solution.
(The GPS stays alive so long as the application is running.)
it is possible that GPD0: works better then GPS0:
GPD is basically GPSID (GPS Intermediate Driver) - the one that use virtual COM port to connect to GPS driver and allow multiple applications to use GPS signal.
Also GPSOpenDevice open GPD not GPS, therefor it make sense to keep that driver alive, and it will (probably) keep real GPS driver ON.
Maybe that is a reason why my application didn't work 100% on my HTC diamond.... I'm going to try that
mligor said:
it is possible that GPD0: works better then GPS0:
Click to expand...
Click to collapse
CamerAware Buddy uses GPD0 and works 100% on FUZE.
I use D1(one) state to keep power-drain at lowest possible. I don't use SystemIdleTimerReset(), yet.
For lowest possible power drain, it's best to go with a SiRFIII (or MK) chip-based external bluetooth puck. The Qualcomm GPSone is a huge, inefficient, power-drainer compared to BT+SiRFIII.
I have tried and using GPSID works great.
basically to keep GPS signal alive there are two possibilities (depends what you need):
1) in case that you want to keep LCD ON
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- call SystemIdleTimerReset() often enough that LCD will not go OFF and/or device to go to sleep.
in this case when user Press Power button, your will get notification that device is going in Unattended mode, and you have to keep device alive with SystemIdleTimerReset() and to prevent never going in Sleep mode.
in this case user will be able to "switch off" device, but your application will continue running. You can also optimize application that in Unattended mode, nothing is updated on the screen, and less CPU to use (to save a bit battery)
2) in case that you do not want to keep LCD On all the time
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- but DO NOT call SystemIdleTimerReset() unless device is in Unattended mode
when user press Power button or device automatically switch off LCD after timeout, you will get notification about it and THEN call SystemIdleTimerReset to keep device alive. When device is again in ON mode, SystemIdleTimerReset should not be called.
This will ensure your application to work transparent, and it is perfect for some kind of GPS logger etc...
---
all this is very nice, and my GPS logger works perfect, BUT (arghhh!!) when I keep GPSID alive, power consumption is going to be very high (~150mA), and that is for my 900mAh battery a lot of power (max 6h)
What are your experience about power consumption of GPS? Can be that something else on my phone eat so much power or that is GPS chip?
GpsLoc has been updated into a full application.
See "Astrolabe - SMS your GPS position" at http://forum.xda-developers.com/showthread.php?p=4037827
Tests showed that in auto power saving mode the battery (of a HTC Polaris, 1350 mAh) would be depleted in about 16 hours, if no GPS signal is available; if there is a GPS signal, the autonomy should be greatly increased (an informal test indicates more than twice the autonomy). Without power saving, the battery would be depleted in about 6 hours.
(Using GPS0 didn't keep the GPS on when my PDA was in standby mode. GPD0 did.)
Could not find this kind of simple app on xda so I wrote 3 quick apps. No screens or user interaction just execute them to set sound profile to Silent, Vibrate or Normal. SHould work with WM6.1 and up with or without Touchflo. You do need CF3.5
3/12/2010: Added PFSwitch utitlity which has the follwing switches:
Run with no switch:
Read current phone setting and move to the next profile. This toggles between Normal, Vibrate & Silent.
Run with 1 switch:
onoroff = toggle between on and silent only
onorvibe = toggle between on and vibrate only
normal = go to normal mode
vibe = go to vibrate mode
silent = go to silent mode
Run with 3 switches:
normal x y = go to normal and set system volume to x and ring volume to y (note x & y can be 0,20,40,60,80,100)
Run with 5 switches:
normal x y run runparms = same as 3 switches but when exiting run program 'run' and send params 'runparams'
Some examples:
PFSwitch silent = set phone to silent profile
PFSwitch normal 60 100 = set phone to normal sound with system sound at 60% and ring volume at 100%
PFSwitch normal 100 100 "\windows\iexplore.exe" "www.xda-develpoers.com" = set sound to normal both system and ring at 100% and when done launch internet explorer to go to xda website
PFSwitch silent 0 0 "\Windows\ctlpnl.exe" "cplmain.cpl,11,0" = set phone to silent and when exiting run Control Panel and open to tab 11 ident 0 (Menu Items I think)
Note: to run a program you must have the complete path since win mo does not allow relative paths.
PFSwitch V2.0
Added 9 new switches which are optional.
Switch 6 = ACTimeout
Switch 7 = ACTimeoutUnchecked
Switch 8 = BatteryTimeout
Switch 9 = BatteryTimeoutUnchecked
Switch 10 = Brightness
Switch 11 = ACSuspendTimeout
Switch 12 = BattSuspendTimeout
Switch 13 = ACSuspendTimeoutSave
Switch 14 = BattSuspendTimeoutSave
Example:
PFSwitch "" "" "" "" "" "" "" 30 0 3 "" "" "" "" would set backlight timeout on and at 30 seconds and brightness to 3
thanks
Thanks for this ebernazz2.
Been looking for ages for something just like this.
niccccccceee...
These sort of apps are always usefull. I just wish there was an app like this to toggle between USB and ActiveSync...
You placed 3 copies of the same file in each cab Instead you should have just placed the exe in a folder inside %CE1% ("Program Files" folder according with OS language) and the shortcut in %CE11% ("Start Menu/Programs" files folder according with OS language)
Would you be willing to make a version that toggles normal->vibe->mute each time the app is launched and with command line support (so we can create shortcuts with the command to select which profile to set)?
Sure I will make a single app that goes from normal to vibrate to silent if no command line argument is passed and if an argument is passed then it will go to that one.
Eric
Here you go. I don't have my phone with me to test this so please let me know if it does not work.
PFSwitch will toggle between normal, vibe and silent if run without any command line input. If you prefer to have a command line input to get to a specific profile then simply run it with one of the following switches:
normal
vibe
silent
Eric
Thank you! Already tested in my device and both toggle and command functions are working
I don;t understand what you mean by an app from USB to activesync. I don;t ever connect my phone to my PC so is tat what you are asking for?
Eric
Recent phones (like the Samsung Omina) have the ability to either connect to a PC by means of ActiveSync (RNDIS) or real USB connection (Mass Storage mode for memory cards or internal storage).
The advantage of the Mass Storage mode is that it's much faster and can be used in a Win PC without ActiveSync or other OSes.
I currently have a link in my today screen to a dirty MortScript I wrote (but most likely it's written in a device specific way and only works in the Omnia):
Code:
usb = RegRead ( "HKLM", "Drivers\USB\FunctionDrivers", "DefaultClientDriver" )
If ( usb eq "RNDIS" )
Run ( "\Windows\USBSetting.exe" )
Sleep ( 200 )
SendSpecial ( "Down" )
Sleep ( 50 )
SendSpecial ( "CR" )
Sleep ( 50 )
SendOK
ElseIf ( usb eq "Mass_Storage_Class" )
Run ( "\Windows\USBSetting.exe" )
Sleep ( 200 )
SendSpecial ( "Up" )
Sleep ( 50 )
SendSpecial ( "CR" )
Sleep ( 50 )
SendOK
EndIf
See my PM ans see if that helps. If not let me know.
Eric
I get you now. Let me see if it is just a registry update or do I have to call a function in core.dll.
Eric
I think that just changing the registry won't work (or at least I wasn't able to do a MortScript to do so... though I'm really not a coder).
frmariam said:
I think that just changing the registry won't work (or at least I wasn't able to do a MortScript to do so... though I'm really not a coder).
Click to expand...
Click to collapse
You are correct. The problem comes from the necessary events that winmo needs. In essence the app you used is loading the appropriate drivers that are specific to the hardware manufacturer. That needs to happen through ActivateDeviceEX function which is why simple setting of the registry won't help (it actually will assign the a new number in the registry HKLM\Drivers\active). I see no easy way around that coupled with the problem that the driver is manufacturer dependent.
Eric
Sounds like a big hassle for such an apparently small function...
I really hate how so much stuff in WinMo is device specific though it just seems like a side effect to the fact that Microsoft leaves all these things up to the device manufacturers... Maybe this will change in WinMo7 (not that it'll be available for my device anyway...). I really wish that the mobile OSes were in many aspects more like the PC OSes (like the fact you can install the OS if your device has the specs to run it rather than your manufacturer choosing if you are "allowed" to update it).
ebernazz2 said:
Could not find this kind of simple app on xda so I wrote 3 quick apps. No screens or user interaction just execute them to set sound profile to Silent, Vibrate or Normal. SHould work with WM6.1 and up with or without Touchflo. You do need CF3.5
Click to expand...
Click to collapse
Hi, I am using action screen to build a phone profile switcher: night, gps, car, outdoor, home, internet, mute...The code controls succesfully the system volume but I do not seem to update with success the ringer volume. Would it be possible to add a functionality to your app to define mode (mute, silent, normal) and at the sametime setup the volume for both ringer and system? Or could you help me understand if it is something that can be controlled writing to the registry? it is device specific? the scripts I found so far do not work in my polaris
Not sure what you mean.... I have an app that rotates from silent to vibrate to ring or you can set a switch to go directly to a profile. If you want to control sound or profile I can give you code but it would be Visual Studio code. What is Action Screen? IF you are asking if the system and ringer volume require 2 methods to set the answer is yes. You have to set both if you want both to change. Do you want to see the difference between setting the system sound vs ringer sound?
Eric
OK, actionscreen is an old htc program used to launch new sms, new mms and so on. It is just a popup menu (fullscreen) that gets away if not used after a couple of seconds. It is simply an app that has shortcuts written to the registry and launches them.
In my case I have not been able to start using visual studio, so I usually work with mortscript to launch scripts. In combination with any popupmenu like actionscreen I launch mosrtscript files that change the profile: eg my car profile will set bt discoverable, wifi off, full brightness, etc. my night profile with mute the system sound but keep the ringer volume in case someone calls for something important. My internet profile will open wifi, disable bt, etc. Using mortscipt I am able to change the icon so when I choose a profile the wifi icon gets red if activated and the profile icon gets the image of the active profile.
So basically I want an exe or mortscript file that can do two things at the same time: switch or set the mode (mute, silent, vibrate) and define the volume for the ringer and for the system. I do not know if it is more clear what I am looking for ?¿!!'¡'¿?!
thanks
I get you now.
I could write a .net app that takes 3 parameters. Lets say I call it SetSound2.
You would then use SetSound2 x y z where x would be mute, vibe or normal - and y would be the system volume level (20,40,60,80,100 percent) - and z would be the ringer volume (same numbers as y).
Would that help you?
Eric
ebernazz2 said:
I get you now.
I could write a .net app that takes 3 parameters. Lets say I call it SetSound2.
You would then use SetSound2 x y z where x would be mute, vibe or normal - and y would be the system volume level (20,40,60,80,100 percent) - and z would be the ringer volume (same numbers as y).
Would that help you?
Eric
Click to expand...
Click to collapse
That's just how I imagined it !!! Would you do that ??
Thanks Eric
Sure. I will write that tonight after work and post it for you as long as you test it out and let me know if is doing what you desire.
Eric
I'm in the process of building a pogo dock using the information in this thread, but starting from scratch rather than using the code or schematics found there. The basic docking process is straightforward enough, but one thing I don't understand is how the data pin is used for audio output. This thread seems to indicate that the audio is transmitted as SPDIF through the middle pin, which seems reasonable enough. I don't currently plan on supporting audio output on my dock, but I'd like to design the hardware in a manner that would allow me to use it if I feel like it in the future. I have most of the design worked out, with only one problem. My current code is built around a state machine with the current states (currently no audio support)
IDLE -> WAKEUP_PULSE -> RESPONSE_PULSE_1 -> RESPONSE_PULSE_2 -> RESPONSE_PULSE_3 -> IDLE
The idle state waits for a posedge pin-change interrupt on the data pin to indicate that the phone has sent a wakeup pulse
In the WAKEUP_PULSE state, it debounces the data pin signal and then waits for a negedge pin-change interrupt on the data pin within a specified threshold window of 80-120ms from the initial posedge (+/- 20ms tolerance for the 100ms pulse width). If the negedge is received within the window, start sending the response, if not, return to idle.
The RESPONSE_PULSE states are simple timer interrupts to send the specified pulse times (H/L/H), then return to IDLE.
This state machine works fine as long as there's no audio. Adding audio requires 2 things. First of all, re-transmitting audio data as it is received, and differentiating between audio data and a new wakeup pulse so that the dock will properly respond the next time you insert the phone into the dock.
The first part (re-transmitting the data signal) is fairly straightforward. The second part would involve modifying the state machine to
IDLE -> WAKEUP_PULSE -> RESPONSE_PULSE_1 -> RESPONSE_PULSE_2 -> RESPONSE_PULSE_3 -> AUDIO -> IDLE
but the difficulty is figuring out how to detect when I should transition from the AUDIO state to the IDLE state. In other words, how can I detect when the phone has been undocked? I have a couple of ideas, but I don't know how the signal behaves. First of all, what state is the data pin in when you have it docked to an audio-capable dock, but it isn't actively transmitting audio? Does it tri-state the pin, or does it drive it to high or low, or does it just continue to transmit a logic 0, which, for SPDIF would look like a square wave at the data clock frequency? If it drives low or transmits a Differential-Manchester logic 0, then it would be a simple manner of enabling the internal pull-up on that pin of the microcontroller and using a watchdog timer that resets at every posedge, and if the timer runs out, then we return to idle. However, this wouldn't work if the phone tri-states the pin, because it would detect the tri-state as being the same as undocking the phone.
I don't currently have access to a logic analyzer or oscilloscope, or else I'd test it out myself. If anybody has any knowledge of this behavior, I'd greatly appreciate it.
So I know some time ago, this functionality had been hacked using a combination of the NFC LockscreenOFF Xposed module and modification of the NFC apk. Base on what I can find in the forums, this last worked with Lollipop, but there seems to be little or no activity on this front since then.
I'm just wondering if anyone knows of a way to restore this functionality in Oreo, or if the discussion has ceased because there is a simpler, more obvious solution that I can't find.
Essentially, my goal is to have an NFC tag on my phone cradle in my car which facilitates Tasker profiles/tasks for using the phone in the car. My current setup *sorta* works. The tag sets a variable, and when the variable is set and the phone is plugged in, the profiles/tasks execute. When the phone is unplugged, the exit tasks execute, including clearing the variable set by the NFC tag.
The problem is that if I turn the screen off, the process repeats itself the next time I turn the screen on.
Ideally, the NFC tag would be detected even if the screen is off, the entry tasks would run, and the exit tasks would be triggered by the NFC tag being lost (phone removed from the cradle). Because the tag would still be detected when the screen is off, I wouldn't have to worry about the tasks executing again when I turn the screen on. I could skip the variable entirely and eliminate the "powered" condition for the profile.
Any insight on a solution for this would be much appreciated. If this is the wrong section, please point me in the right direction. I searched every applicable forum I could think of, so my apologies if I've overlooked something.
I'm running a Nexus 5X, stock Oreo 8.1, rooted with Magisk and running systemless Xposed. Tasker and Secure Settings are installed, if that matters.
Thanks in advance for any input.
Looking for this as well. Did you ever find a solution?