Handling gpio value using localhost - c#

i am making a Universal windows Application for home automation, the app UI and hardware interfacing is ready and working
i'm using raspberry pi 2 to serve as gpio
and i plan to use the same app on my windows phone to trigger the ON/OFF request over same local network
the GPIO Hardware interfacing is done and is working
i'm stuck at a point "How do i communicate between my phone app and raspberry pi?"
they are connected to same wifi network
i am a C#/.Net person, and any solution available over internet is for Python/Java.

There are several solutions for your question but none will involve only C# on the raspberry side. What I did (is one of the solutions available but you can choose to use pyton, for example) was to use Node.JS and run a server on a raspberry pi and connect to that server (it could be any type of server TCP server, telnet, web, etc.) and connect from C# to that server and then interact with your GPIO normally. There are libraries in Node.JS (https://www.npmjs.com/package/pi-gpio) to control GPIO so you can write code to handle a connection from your C# app and when connected turn on/off a certain GPIO.
Something like the following will create a TCP server on the raspberry pi and from your C# program you will need to connect to that IP (raspberry IP) and port (1337) and do whatever you want to do.
It is worth the time it will take learn Node.JS (it won't be complicated if you already know C# but it will take time to get used to the syntaxis but you can do so much after you know how it works).
var net = require('net');
var server = net.createServer(function(socket) {
socket.write('Echo server\r\n');
socket.pipe(socket);
});
server.listen(1337, '127.0.0.1');

NodeJs is probably a good portable choice.
But if you want to do it from Windows in C#, ASP.NET, check out the Nusbio device.
You can control gpios from a web site. See the Console demo which use the Nancy web server.

Related

WiFi Communication C# and ESP8266

I'm working on a project and am looking for a way to connect with ESP8266 via WiFi module on ESP8266. I have to build use this method, through the windows desktop I can control the movement of robot. From C# to ESP just like remote control project. I have a lack of knowledge of C# same as basics of servers/internet but I have everything done in Arduino IDE code and control the robot through web browser but I'm stuck on Communication Wifi between C# and ESP866. I need some help. Thanks in advance
You can host a REST API Server in the ESP8266 with the using the ESP8266WebServer and use your usual REST Programming in C# like RestSharp or Flurl.

Transferring files from windows ce to desktop

Is there a way to connect a Windows CE 6.0 device to a Windows 7 desktop PC without using activesync
There's no way to just connect the two and have them communicate without some form of driver or application being written. ActiveSync/WMDC is what Microsoft shipped "out of the box". If you want to do what it does, then you have to replace it with another app or protocol, and it generally requires you to do both sides - a device app and a PC app.
What that would look like depends on how you intend to connect. If you want to use USB, then you can likely use the CE RNDIS driver, so that the device shows up as an NDIS device, then use the desktop APIs to send network traffic to and from the device. Of course you'll have to put an app or service on the device that knows how to take commands and do something with them.

.net to QT networking outside home network [duplicate]

This question already has an answer here:
making a p2p applicaion beteen QT and .Net [closed]
(1 answer)
Closed 8 years ago.
Hi I want develop a communicate from a.net application running on Amazon AWC or microsoft azure
to a QT application in a Linux device in a local network (connected to Internet using a router).
I tried with QTWebApp in Qt and create a server in the device. it work in a local network. but cant find the app without port directing in the router.
basically i want someting like p2p kind of connection.
when QT app switch on, it to send a message to .net application with ip,port etc witch can be use by .net app anytime to connect to the QT app.
Somthing like signalR or p2p or any good solution....
If you want to do it without any changes to the port redirection in the router, you'd be best off opening a connection from the Qt app and polling the .net application on the server for data and then acting upon it in the Qt application. Trying to do it so you're opening a connection to the Qt application from the .net application will require a fixed IP and a redirected port.

I want to remotely run linux programs and return output using C# or similar language

I am planning for my Capstone for my degree.
In this project I will be utilizing an ARM board loaded with a specific linux distribution. (Currently either Debian or Ubuntu based.)
This ARM board will be sitting on a network using either WiFi or wired LAN or combinations of both or multiple WiFi connections.
I will be using a PC likely running Windows to access this ARM board. Due to the nature of the intention of this setup I will NOT be using the LAN connection to control the ARM board but will be using a USB connection from the PC to the board.
I have seen some applications on an Android tablet where they install a Ubuntu host and run it on the android box in the background. They can then access this via VNC, telnet or ssh. They then have built native applications for the Android that communicate with the Ubuntu host and remotely run software on the Ubuntu host and use the data returned. Basically they are building a GUI that remotely runs the commands and displays the results in some form.
I want to build a system for my capstone that uses 1 or more ARM boards to do menial work while the PC listens to them and returns status as it becomes available.
I have seen mention of using socket programming and the Expect package written in tcl. Are these the best technologies I can use or is there something better for me to look at? Currently I am doing a bunch of work in both C# and Java but the end result program I will be building is likely to be in C# so I am looking for information to head me in the right direction. I am 3-5 years away from my degree so I am not against making a new library in C or C# to do the work for me. So porting Expect COULD be an option. I ultimately need something that works very quickly due to the nature of my intended application and I need isolation of the PC from the LAN so I will NOT be using the LAN for the control connection.
Thanks for any help or guidance!
Rodney

Terminating and Starting Data Connection on Windows Mobile 6.5 in C#?

I want to create an easy application for windows mobile devices, i have recently got a HTC HD2 and the connection is being eaten by the weather app, email accounts and windows live service :#
I am getting rather annoyed with this and well I have set myself a project to give myself a small piece of glory and create a working application that will Terminate an idle connection on my phone.
I am using C# and the latest WM6.5 sdk.
How do I access these controls?
You should use the ConnectionManager APIs to access device connections. It will create them or hand existing connections to your application. Closing a connection is actually very difficult to do (probably becasue it's not terribly nice to tear a connection out from under another running app) and has to be done via P/Invoking to RAS.

Categories

Resources