Implementing google smart action with custom device trait - google-smart-home

I have been trying for a while now to create a kind of "controller" for my windows pc which is integrated with google assistant.
I would like to have actions like "Turn off the internet", "Shutdown" or "Open program".
However in trying to implement this with Google smart action API I see that it "only" supports a set of traits. I know I can "reuse" different traits for different actions, like "OnOff" to control pc power, but how about starting programs on my pc?
I would like to use natural commands (Hey Google, open Word), instead of the conversational API which is (Hey Google, talk to my pc -> open Word), but I would understand if that is not possible, since the traits are how Google HomeGraph knows which devices supports the users query.
Am I going into a rabbithole of impossibilities and should I just bite the bullet and use the Conversational API?
Any open source projects which is doing this would also be appreciated, end goal is implementing something myself, but inspiration is always nice.

I previously built my own PC integration with the smart home platform and gave it a few commands.
Going through smart home means that you cannot add custom device traits. Whichever exist in the platform are it. However, there are quite a few traits available for use.
In your set of use cases, there is an AppSelector trait and a NetworkControl trait. You may be interested in using both of these.

Related

Finger capture in React-native

I came across an app and wanted to implement the same in React-native but I couldn't find any library which gives me this feature Or any other way to implement it.
I want to capture a single-finger picture.
Is there any library in React-Native?
Actually, if you want to capture fingerprints you can use react-native-fingerprint-scanner, or there are several React Native libraries that you can use to pass biometric security of OS, it won't give you the fingerprint data. it just uses a Native API of OS to just compare fingerprint to saved on and tell you it is passed or not.
If you considered, gathering fingerprints data from users by using biometrics, it's not possible. but you can use it another way. use camera, you know, I was studying artificial intelligence in my Master degree, I used palmprints for my project.
Or gather data from some universities or institutes like RIKEN studio.

How to get current system DNS resolvers ip-addresses in codename one?

Is there a way to get all current system DNS resolver ip-addresses in codename one?
The classes NetworkManager and ConnectionRequest don't provide these information.
In general Codename One seems not to provide any way to access a devices communication status information like "Wi-Fi Mac address", "IMEI", "Mobile network type" etc. Am I right?
Do you mean something like Socket.getHostOrIP()?
There is no standardized explicit DNS lookup API though.
Most of these things aren't available across platform or even consistently within the platform. You can use Display's getProperty with "IMEI", "UDID" & "MSISDN". But that will only have any chance of working on Android and you will probably need to add the build hint for permissions.
You can also always use native code calls as explained in the developer guide and the How Do I? video.
I would suggest that you revisit your need to get these values and evaluate a way around them. E.g most advertisers no longer require them as they aren't provided by all mobile OS's.

What is equivalent usage of sendmessage()[WINDOWS] in MAC OS X?

I have a ContextualMenuPlugin and an application. When user clicks the option from context menu i need to send a message to my app. In windows i achieved this using sendmessage() function. But i'm new to MAC OS X. Can any one please help me, by giving some api's or functions which will enlighten this situation?
You have plenty of choices on how to get messages into an application on your Macintosh.
The ways I'm thinking of include Apple Events or sockets or kqueues, but there's other stuff I've never even worked with that might even be more useful & appropriate (such as Distributed Objects). Check out this duplicate and/or related question and maybe you'll see a useful answer in there for you that you can build upon.
B.T.W.: how did you construct your Contextual Menu Plugin? Is it in Carbon or Objective C or is it some codeless plugin or plist or? The answer to that question probably will dictate a lot towards how you will be able to talk from your plugin to your app.
If you want to control just your application you might want to look into AppleScript. Using that solution has the added benefit that your users could also use it to automate things via scripting.

Feature tracking WinForms

I would like to extend my WinForms app, which a feature that allows me to monitor which functions are used by the users.
The idea is to count how many times e.g. a button has been clicked, or a popup was opened.
I want to know which features are used more or less often by the users.
Any ideas how this can be done? (Or even if somebody solved this problem already)
tia,
Martin
The only mechanism I can think on to do what your looking for is to use a logger like log4net / Log4PostSharp to log details to a log file on the machine, this would give you details on usage for that particular client. You would have to create a custom attribute that you could decorate your methods with that would result in something being written out to the log file, otherwise your code would end up littered with code to implement the logging!
Have a look at this article too, it uses Log4PostSharp with AOP (Aspect Oriented Programming) which would make the implementation of the logging much more cleaner (uses attributes).
http://www.codeproject.com/KB/dotnet/log4postsharp-intro.aspx
You can find some if you google for the term "application analytics" instead of "feature tracking".
I have found the following products:
includeapp.com
Software Statistics Service
Dotfuscator for .NET, DashO for Java
FusionAnalytics
Flurry Analytics
OpenSpan Desktop Analytics
DeskMetrics
EQATEC Analytics
Rapidengines
I might say that I also plan to create such a product. When it will be Beta I will add it to the list.

How to switch users in a smooth way in a Point-Of-Sale system?

I am designing a Point-Of-Sale system for a small shop. The shop just have one Point-Of-Sale but often they are one to three users (sellers) in the shop. Each user have their own user account in the system so they login and logout very often. How should I design the login/logout system in a good way?
For the moment the users don't use passwords, because it takes so long time to type the password each time they login.
The Platform is Windows Vista but I would like to support Windows 7 too. We use Active Directory on the Network. The system is developed in Java/Swing for the moment, but I'm thinking about to change to C#.NET/WPF.
I am thinking about an SmartCard solution, but I don't know if that fits my situation. It would be more secure (which I like) but I don't know if it will be easy to implement and smooth to use, i.e. can I have the POS-system running in the background or started very quickly when the users switch? Are SmartCard solutions very expensive? (My customers are small shops) Is it preferred to use .NET or Java in a SmartCard solution?
What other solutions do I have other than passwords/no passwords/smartcards?
How should I design the login/logout system in a good way?
Is there any good solution using SmartCards for this purpose?
I would like suggested solutions both for C#.NET/WPF and Java/Swing platforms.
I would like suggested solutions both for Active Directory solutions and solutions that only use one user profile in Windows.
How is this problem solved in similar products? I have only seen password-solutions, but they are clumsy.
An interesting solution is to use "Fast User Switching", i.e. the capability to have multiple user sessions open on the same PC. The POS software could be launched through the Startup folder of each seller account and would stay active in each seller session.
I thought that being in a domain (i.e. using Active Directory) disables Fast User Switching, but according to The old new thing, this was true on XP only. I just checked with my Win7 machine at work: it is in a domain but still has the "switch user" menu item.
The main advantage is that if your software is already multi-user aware, you don't need to change it.
I should have made the Fast User Switching check before writing what is below, because this seems to be the simplest solution. Here are other ideas, anyway.
Another solution is what you mention of having a single Windows user but several "virtual users" that your application manages. A smart card is a good way to implement a pseudo-login. In C++, the API allows detecting the removal or insertion of a card, so the application could detect this and read the card after insertion to know who's currently in front of the computer. .NET can easily call this API through P/Invoke; I don't know much of Java, except that JNI could be a solution to call the native API if there is no managed library that publishes this capability.
What should be done is researching the different types of card and how to talk to them, as your app should use a card that does not require a PIN to be accessed (or you are back to the slow login system, except if tying a 4-digit number is not considered too slow).
I've seen restaurants where waiters insert a key into the cash register in order to be identified. I googled "cash registers" but could only find a complete solution package, rather than the components like a key reader.
An almost idiotic question is: how much security do you need ? Does it make sense to have big buttons on the first screen of the app, where people click in order to tell the system who they are ? When they are done, they click on a "Finish" button and the app goes back to the "identify" screen. I've put this at the end because it is so simplistic that it has a low probability of being useful.
I'm not familiar with a broad range of smart card provider solutions, but I know Gemalto has a .Net friendly setup. Most others are geared to Java, but support is widening.
With regards to switching user sessions and your application, it depends on how "heavy" your application is. If your app requires quite a bit of start-up time / resources then you might consider creating the basic application as a service on the machine which can run in the background continuously and then you can load a light-weight UI to interact with the service with each user session (maybe launch via Startup menu).
There is a C# project on CodeProject which provides a framework for interacting with smart card services in windows - might be interesting reading.
I had a chance to work with the Open Source Computer Vision library (OpenCV)
in one of my past projects and its "Face-Recognition" is what you're after. It is written using native code, but can be easily used with Java, .NET, Android, iOS. All you need is a webcam and a button "Switch User" with the onClickListener that will take a picture and compare it with the images of your employees. Advantage? Once the picture's taken, it gets processed in less than 10ms. And as Timores mentioned earlier, once the face is recognised, you simply switch the session. Simple yet effective solution. Good luck!
maybe you want to think about using barcode scanner... probably you already have this device on POS ... my software for bars and restaurants use barcode scanner to recognize users. You have 2 options for using: first, user must log in with own barcode card, then he can use the application ... the second is better, everyone can use application, but to print the receipt user must use barcode card. After then he is responsible for that amount on this receipt.

Resources