Is there a way to detect when the glasses are put downˆ - google-glass

Is there any means to detect when the glasses are put down?
Ideally, I'm looking for a broadcast event, but any other means will suffice. I must be able to differentiate when the glasses are actually put down versus going to sleep while still on the user's face.
App is native in Immersion mode.

And here it is:
Broadcast action: ACTION_ON_HEAD_STATE_CHANGED
https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/content/Intents

Related

How to poll mouse macro keys without third party software?

Lets say we've got a Gaming MMO-mouse that has 12 keys at the side.
I researched a bit and found out that Windows doesnt really support so many keys so you'd have to use the mouse driver to access the keys. What I didnt find is, how do you access the keys with the driver?
All these mice have their respective software that lets you rebind them but whats interesting to me is how that looks like on a lower level without the software.
How do I poll for the pressed macro keys in my own c++ program?
How do we exchange information with the driver?
Suggest, write a small program that polls the USB port where the mouse is connected,
each time it receives data from the mouse, display that data.
Keep track of the correlation between which mouse action you made and the resulting input from the mouse.

Some questions about Canon Edsdk 2.14API with C++

I am a new programmer in C++ with the EDSDK 2.14. I am using a Canon EOS 5D Mark II and i have some questions to do (i'm starting the api, camera session, handlers, set capacity,my program take photos, set the correct parameters to the camera and i'm using windows message to treat some events) :
1) I need to save the photos in the host pc, i am doing this correct, but the camera only permits like 8 photos in the internal buffer and i need to test some combinations of parameters (AV,TV and ISO SPEED). I make a loop to take 10 photos when i press 's' (with windows message, callback), and only 8 photos was taken, the others have busy error, so i guess that is the internal buffer. How can i take more than 8 photos, changing the parameters correct with one windows event?
ps: I tried to reopensession (close and open session with camera again) but was not a good idea, because the event handle of transfer (download image) was only set with the release of the object.
2) I tried to get one photo and download, but was not possible, when i press 's', the program wait to take the 8 photos, and after that the camera send the event callback to the handle for download all images. I want to press 's', and the program take one photo, download and take the others, if it is possible, how could i do this?
3) If i make a method to set the AV, TV , ISO Speed parameters, this will be sent to the camera in time to take the photo, or i need to wait something like a callback of the camera. If i need something like that, what event i need to use?
ps: my program is all asynchronous, i am not using threads, only callbacks and windows event.
4) I search in internet about to put the correct focus, but some people said that is only possible in live view, and i can't use this in my application. It is possible to change focus without live view?
ps: Because i need a good photo and the autofocus of the camera with my program, is not doing the same quality of images like the EOS Utility, and i am thinking if they have a pos-processing in the image taken or not
If i have more questions or i resolved the questions i will answer to all the community, because this too many guys are using this API and it's not too trivial. Sorry about my english, i am not native in this language, but i am trying to do my best.
ad 1) you need to download the image before the camera's internal buffer overflow, like you try in 2
ad 2) make sure your program, after sending the first shot commands, somehow comes back in the 'global' event loop. This should give the EDSDK a chance to process camera events and send "download available" events to your callbacks. Take it from there
ad 3) no guarantees whether these events are applied, you'd rather attach to a property change event (kEdsPropertyEvent_PropertyChanged) or poll some time after
ad 4) you can use liveview and lens-based AF. For the latter, explore kEdsCameraCommand_ShutterButton_Halfway
Care to share the goal of your project?

how do i prevent screen-savers and sleeps during my program execution?

In a c++ program run on Win7, is there a way to fake a mouse movement or something like that, just to keep the screen saver from starting and the system from going to sleep? I'm looking for the minimal approach and I prefer not to use .NET.
Thanks,
-nuun
Don't mess with the screensaver settings, use SetThreadExecutionState. This is the API for informing windows on the fact that your application is active:
Enables an application to inform the
system that it is in use, thereby
preventing the system from entering
sleep or turning off the display while
the application is running.
, and
Multimedia applications, such as video
players and presentation applications,
must use ES_DISPLAY_REQUIRED when they
display video for long periods of time
without user input
That's not a bad idea, any decent media player does it... Look for SystemParametersInfo(SPI_SETSCREENSAVEACTIVE ...) function in Win32 api, it should do the trick.
Before Windows starts screen-saver, it sends SC_SCREENSAVE notification in WM_SYSCOMMAND message to applications. If application wants to prevent screen-saver from starting, it should set "handled" flag to true and return zero during message processing. There is also SC_MONITORPOWER to prevent display from going to low power state.
https://learn.microsoft.com/en-us/windows/desktop/menurc/wm-syscommand

How can you detect the pressure with which the screen is pressed?

Hey all .. i wanted to know, in C++/Qt, how can one detect with how much pressure the screen is being pressed when a project is on the N900 ?.. Can anyone help me on this ?
Its very much possible to get pressure data. In GTK/GDK you register for all extension events with gtk_widget_set_extension_events()
gtk_widget_set_extension_events(widget, GDK_EXTENSION_EVENTS_ALL);
and you will start receiving move/pressure events as well. The link Olorin posted could be the Qt interface for the same, but I haven't used it so cannot say for sure.

Get the current mouse coordinates

I have an iMac, and I want to be able to turn off the monitor when I go to sleep,. Alas, the iMac has no switch for this. I do not want to put the iMac into sleep mode, i want to write a "expose" like application or service, which when the mouse is put into the upper left hand corner of my screen, the display will sleep. Likewise, if i move the mouse away, it comes back.
Does anyone have experience with tracking mouse movements within the Windows and Display APIs I'd need to look up. I just need some direction to get started.
Cheers!
Chris
I've been asked to clarrify. Sorry if i'm confusing anyone. I'm running Windows Vista 32 via Bootcamp. I like that Mac OSX has a "hot corners" feature via Expose. I have noticed that besides power managment which runs on a time metric, there is no way to sleep the display at will in Vista.
I would like to write my own tool for this. I might be a glutton for punishment, but i'm a coder, and it's a good excuse to learn something new.
In Leopard, you can just go to "System Preferences" and "Desktop & Screensaver". Click the Screensaver tab, click "Hot Corners", selected the corner you want to change, then chose "Sleep display". Does that not work?
If it's an old CRT iMac then you can't switch off the screen without switching the computer off - the convection from the CRT is used to cool the processor!
Not really the answer you seem to be looking for, but cant you do this via the power save option and/or the screen saver - can it be set to nothing.
Can you not use the monitor power button?
Thanks for the clarification, Chris. I would reiterate:
just use a pre-existing solution like this: http://www.southbaypc.com/HotCorners/ (untested anything that does the same thing would work). If it allows you to run your pre-selected screensaver, then all you need to do is ...
... make an exe that does what you want (sleep the screen) and then rename it whatever.scr http://computer.howstuffworks.com/screensaver.htm/printable Do you have this working yet?
Once you get that working (and you can enjoy a Windows version of your desired OS X hot corners functionality) then worry about how hot corners are implemented. Your Win32 API question is still a good question but like you said you sound like you want to build it yourself. If that is the case, I would post a new question "Hot corners in Windows Win32 API Low level mouse tracking" or something to that effect and just ask: "how do these Hot Corners programs detect hot corner mouse-over events?" By the way my brother used the low level API to move the mouse cursor and simulate clicks so I know what you're asking is probably possible. It's just that your REAL question seems barried in all this discussion.