I am new to IoT development and a moderate user of C#.
The business ask I have is to install a programmable light on a machine and expose a local restful web service to flip on the light in the event of an issue. I have a USB light (from Kuando) with a SDK that I have written a simple test interface dll using. It can claim the device, invoke various blinking patterns, and release the device. When implemented into a windows form project this works like a champ. However, trying to include this dll in a web service project is not going so well.
When attempting to instantiate the object and claim the device, I get an error stating "System event notifications are not supported under the current context". I assume this is an underlying security issue with allowing web services to control machine hardware, however, that's exactly what I need to do in this case.
I'm looking for any architecture ideas or concepts that may be out there to help me get around this. Or perhaps I'm a total idiot and missing something easy? Appreciate any help. Peace & humptiness forever.
Related
I already made a service which sends a push notification to my iPhone whenever my pc locks/unlocks, pretty simple. But it would be really nice if i could see the lock status in my home app. Guess i will need to have some kind of "bridge" running as a service on my pc.
So, i was wondering if any of you guys have tried something similar? and can point me in the right direction. If it's even possible of course.
Screenshot of current service notifications
Well, it definitely is possible. I'll give you a short outline:
Get the HAP-Spec: https://developer.apple.com/support/homekit-accessory-protocol/
You need to find a suitable representation for your PC inside the HomeKit ecosystem. That is, think about what Services your PC should expose and how you want to map them to the Services defined by Apple. The problem is that, while the Home app can display any accessory - even if it is a custom one, it will only display some generic information if it doesn't know the accessory's services. I suggest using the Lock Mechanism or Switch service. Choose the one that results in the best-fitting graphical representation inside the Home app. (Check out the spec, there are a lot more services).
Implement your HomeKit accessory: I suggest using https://homebridge.io or https://github.com/homebridge/HAP-NodeJS directly. You may also want to take a look at https://www.npmjs.com/package/homebridge-http-switch, which wouldn't require any HomeKit related coding from your side.
Host your HomeKit accessory: The thing here is that the Home app is going to request the accessory's current state each time you open it. Thus, hosting the bridge on your pc is maybe not the best idea (if your PC is locked and sleeping or powered off, the accessory ether won't answer, or you need Wake on Lan and then the PC-fans and Monitor turn on...depends on your setup). You probably want to host your bridge on a raspberry pi that is always running.
Write some script that sends a http message to your bridge whenever the pc is locked/unlocked.
I come from the web development background, but currently facing a project, which somehow touches the topic of remote hardware manipulation from the web interface.
Prerequisites
Numerous remote tablet devices, operated on (a) Windows and (b) Android OS
React web application
Goal: to develop a React-based web application, which would be able to perform certain actions:
Retrieve system information (e.g. uptime, real-time online/offline status, system logs and errors)
Perform system methods, such as reboot the device or upload new file to a target device file system
Questions: What is the best way to access remote device system methods from a client web application?
Assumptions: I assume (and I might be completely wrong!) the best practice is to:
Develop a Web API based on .NET (for Windows) and Java (for Android) in order to provide an interface to communicate with for the client application in a form of a REST API or similar.
Websockets for real-time status update regarding online/offline status (?)
The rest is a big question mark for me. I would appreciate any help or direction that I have to research further.
I have a project I am working on where I need to create an app and service package for Windows. I would like the service process to run as SYSTEM or LOCALSYSTEM so that credentials are irrelevant. The application frontend will be installed and executable by any user on the machine. Data from the frontend application will be passed to the service - most likely paths to directories selected by users. Once started the service will listen for a command to do some action while accepting the aforementioned paths.
I'm using C# on the .NET platform and I've looked into creating a standalone service and a standalone application separately as well as creating a WCF service library and host application - that's as far as I've gotten.
All of these methods seem overly complex for what I am trying to achieve. What is modern convention when attempting something like this? I'm willing and able to learn the best method for moving forward.
Edit: This was flagged duplicate. I'm not looking for information on HOW to communicate with a Windows service. That's remedial and not at all what I'm asking. I'm looking for validation that I'm on the right track and if I'm not, I'm looking for suggestions. I've been told that I'm on the right track and pointed towards named pipe binding.
Windows Service is certainly an option for hosting WCF, although it kind of is a deployment nightmare. It really depends on your environment and the capability and support of your system admins as I've had many clients where deploying a windows service, as you need admin rights to install and update it, was simply not practical.
Console applications may sound like a terrible idea but the practicality of being able to drop them on a share and run a powershell script to start them is very compelling.
But frankly IIS hosting has the most advantages in my mind as the product is designed for ease of deployment and up time. And you can use any transport binding in IIS that you can use in a Windows Service or Console.
As for the binding itself named pipe is not really a popular option in many enterprise scenarios as it is incompatible with anything but .NET. Although the same can be said for binary which is one of the more performant bindings. The WSHttpBinding is probably the most popular binding in scenarios that require unknown callers. WebHttpBinding is an interesting option as its HTTP/REST based, although that requires further decoration of your operations and honestly if your going that route you should really be using Web API.
I want to build some sort of interface that will monitor our real time routing/switching system. I would like to give a lot of visual feedback to be able to monitor its status visually. Our system and clients are not co-located so they would need to connect via TCP/IP.
I would like to be able to service any number of monitoring clients (although this will probably only ever be about 4-6 clients). I thought of using SilverLight but there appears to be one or two tricks involved in getting SilverLight to connect back to an application running on a different port.
I have also thought of using HTML5 canvas and websockets. Another alternative is to just create the clients using normal Window Forms and perhaps WPF. But this means that to monitor the application the client will have to be downloaded before. I would prefer something that is as easily accessible as web app?
What are some of the more common application stacks to achieve this? What should I watch out for?
EDIT:
Just to add: This will be an internal tool only. But we have offices in a couple of locations.
any choice in this direction could be subjective and arguable, surely somebody could suggest any possible web framework or language...
I would consider, however because of your .NET and C# tags, ASP.NET MVC 3, so basically web based plugin-less ( NO Silverlight ) HTML 5 solution.
Consider that StackOverflow is done in same way (MVC, ASP.NET, SQL Server... ) and outperforms as we all know.
the way you grab the underlying events from TCP, so the way you capture and provide the data from TCP, it's another thing from the front end, I would probably write a Windows Service if the traffic is so high and you want to grab and store data anything regardless any active client connection.
There are plenty of real time charting controls out there also for MVC, MS Chart Control. DevExpress, ExtJS integrated ones...
"real time" and Browser is bothering me.
I would indeed go WPF or WinForms. Using the ClickOnce-Deployment you can make this a no-pain for the user and you can roll-out new versions just by redeploying them and having the user restart the application.
In my company this works really fine and we have no problems whatsoever. The only problem with this is, that the app.config is somewhat hard to find and keep current/valid (redeploy) but in your case this won't change per client (or so I guess).
I agree with #Davide - I would go for a WebService that will obtain all routing/switching data in realtime. You will have a web application and on the client side you will have JQuery/AJAX fetching realtime data from the WebService component.
I've seen cool demo's of Web Orb doing something similar to what you want. http://www.themidnightcoders.com/
If you are starting from scratch, it would be good to check out WCF (Windows Communication Foundation). It's great because it can expose your functionality in many ways, using nothing more than modifying a config file.
If you want a Windows client app, you can host it in a Windows Service, or simply include it as a side assembly. For web apps, you can choose between various formats (JSON, XML), channels (HTTP, TCP) and protocols (SOAP, ODP).
If I got it right, there will be a server-side application which will collect information from the devices and expose it to clients as a service. In that case, a WCF application might be hosted in a Windows Service or IIS on a server machine, and expose the data though one or more endpoints (HTTP, TCP).
I am not aware of problems in connecting a SilverLight app to a service, but I would rather go for a HTML5/JavaScript combo instead, for easier deploying and compatibility with a wider range of devices (no plugins needed). ASP.NET MVC should be the best choice for the web app.
I have to do an integration point between an .net application and SIP (iptel.org) provider. All seems simple but I feel like I don't have much control if I use an external server like iptel.org.
The use case is: As an consumer I
should be able to do a call with the
Phone Number and the Short Message and
treat/report execution status.
For this reason I want to set up my development environment in a way that i can write/test/log the integration interaction.
Here is what I inted to do:
SIP server : miniSipServer ... which will keep my acounts Soft
phone : Express Talk ... for making
sure the server is running and ready
to work SIP stack for .net : SipekSDK with pjsipDll
Resources:
http://sites.google.com/site/sipekvoip/
http://sipsorcery.codeplex.com/
http://callbutler.codeplex.com/
the enumerated resources have not trivial code which is a learning curve for a beginr
Your advice of
where to look for samples
how to wrap it up in less intrusive way
which are the best tools to be configured in dev/testing environment
will be greatly apreciated
Thanks,
Ruslan
I'm the sipsorcery author so I can give you some information on it. The project includes a SIP Proxy which is easy to get up and running. Writing the IronPython script to control how the proxy routes traffic is not so straight forward however if all you are doing is forwarding SIP traffic between your app and iptel it's a lot simpler.
The project is fairly active and there's a dedicated forum for developers to get help on.