Alert.png

Notice: This page contains information for the legacy Phidget21 Library.

Phidget21 is out of support. Bugfixes may be considered on a case by case basis.

Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21.

We recommend that new projects be developed against the Phidget22 Library.


Click on the 2phidget22.jpg button in the menu bar to go to the Phidget22 version of this page.

Alert.png

Phidget WebService: Difference between revisions

From Phidgets Legacy Support
No edit summary
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Overview]]
__TOC__
==General Overview==
==General Overview==


[[Image:webservice_general_broadcast.png|500px|link=|alt=]]
The Phidget WebService is a background process that broadcasts all events and data from a USB Phidget over the network:
 
[[Image:webservice_general_broadcast.png|700px|link=|alt=]]
 
It uses '''link local addressing''' which allows you to use simple server names in your code.  The link local addressing is provided by the programs Bonjour, avahi, or mDNSResponder, depending on your system, and the correct program is either installed already or with the Phidget libraries.
 
You can listen to the Phidget data and control the Phidgets over the network using '''one or more''' computers.  You can still use the Phidget on the computer it is directly connected to, just by using a remote version of the {{Code|open()}} call in your local code:
 
[[Image:webservice_general_pctopc.png|700px|link=|alt=]]
 
Since Phidgets supports many operating systems, the listening and controlling computer doesn't have to be a computer.... it could be an Android phone or an iOS iPhone/iPad:
 
[[Image:webservice_general_pctoandroid.png|700px|link=|alt=]]
 
The WebService runs on a local network.  It is relatively durable because it uses link local addressing, which - depending on your [[#Using The WebService|operating system]] and router settings - will often work in the absence of DHCP.  Link local addressing will often persist even when access to the global Internet fails or is not available.
 
==WebService on the Phidget Single Board Computer==
 
The Phidget Single Board Computer (SBC) can provide a compact, inexpensive way to easily run the WebService.  It runs the WebService in the background automatically from the moment you turn it on, and allows you to read from and control all Phidgets attached to it:


[[Image:webservice_general_sbctopc.png|500px|link=|alt=]]


This page should eventually contain a general overview only.
This can allow for a compact, mobile-based system like this:


Specific instructions on installing the webservice (avahi, etc) should appear in the OS-specific pages.
[[Image:webservice_general_sbctoandroid.png|500px|link=|alt=]]


==Using The Webservice==
The SBC runs Linux, which provides a [[OS - Phidget SBC|full operating system]] on which to develop code, [[Web Page on the SBC|serve web pages]], and [[Use Phidgets Wirelessly with the SBC|control Phidgets]].


Each Operating System page has a section on how to use the webservice on that operating system:
==Using The WebService==


* [[OS - Windows#Webservice|Windows]]
Each Operating System page has a section on how to use the WebService on that operating system:
* [[OS - OS X#Webservice|Mac OS]]
* [[OS - Linux#Webservice|Linux]]
* [[OS - Phidget SBC#Webservice|Linux on the Phidget SBC]]
* [[OS - Android#Webservice|Android]]
* [[OS - iOS#Webservice|iPhone/iPad iOS]]
* [[OS - Windows CE#Webservice|Windows CE]]


* [[OS - Windows#WebService|Windows]]
* [[OS - OS X#WebService|Mac OS]]
* [[OS - Linux#WebService|Linux]]
* [[OS - Phidget SBC#WebService|Linux on the Phidget SBC]]
* [[OS - Android#WebService|Android]]
* [[OS - iOS#WebService|iPhone/iPad iOS]]
* [[OS - Windows CE#WebService|Windows CE]]


The operating systems pages have complete examples on how to set up a running webservice host process and remote program on that operating system.
The operating systems pages have complete examples on how to set up a running webservice process and controlling remote program.  The pages also tell you how to start and stop the WebService on your computer, and how to run it with or without mDNS (Bonjour, avahi, etc).


We also have a couple of code snippets in C and Java on the [[General Phidget Programming#Using Phidgets over a Network|General Phidget Programming page]] to show examples of opening a Phidget remotely.
We also have a couple of code snippets in C and Java on the [[General Phidget Programming#Using Phidgets over a Network|General Phidget Programming page]] to show examples of opening a Phidget remotely.
'''Note:''' When using the WebService, both the '''client and server should have the ''same version''''' of the WebService installed.  The easiest way to ensure this is to update your libraries on both ends.
For other troubleshooting tips, try our General Troubleshooting page, in its [[General_Troubleshooting#Webservice_Troubleshooting|WebService section]].

Latest revision as of 16:47, 28 June 2012

General Overview

The Phidget WebService is a background process that broadcasts all events and data from a USB Phidget over the network:

It uses link local addressing which allows you to use simple server names in your code. The link local addressing is provided by the programs Bonjour, avahi, or mDNSResponder, depending on your system, and the correct program is either installed already or with the Phidget libraries.

You can listen to the Phidget data and control the Phidgets over the network using one or more computers. You can still use the Phidget on the computer it is directly connected to, just by using a remote version of the open() call in your local code:

Since Phidgets supports many operating systems, the listening and controlling computer doesn't have to be a computer.... it could be an Android phone or an iOS iPhone/iPad:

The WebService runs on a local network. It is relatively durable because it uses link local addressing, which - depending on your operating system and router settings - will often work in the absence of DHCP. Link local addressing will often persist even when access to the global Internet fails or is not available.

WebService on the Phidget Single Board Computer

The Phidget Single Board Computer (SBC) can provide a compact, inexpensive way to easily run the WebService. It runs the WebService in the background automatically from the moment you turn it on, and allows you to read from and control all Phidgets attached to it:

This can allow for a compact, mobile-based system like this:

The SBC runs Linux, which provides a full operating system on which to develop code, serve web pages, and control Phidgets.

Using The WebService

Each Operating System page has a section on how to use the WebService on that operating system:

The operating systems pages have complete examples on how to set up a running webservice process and controlling remote program. The pages also tell you how to start and stop the WebService on your computer, and how to run it with or without mDNS (Bonjour, avahi, etc).

We also have a couple of code snippets in C and Java on the General Phidget Programming page to show examples of opening a Phidget remotely.

Note: When using the WebService, both the client and server should have the same version of the WebService installed. The easiest way to ensure this is to update your libraries on both ends.

For other troubleshooting tips, try our General Troubleshooting page, in its WebService section.