https://github.com/captemulation/qphidget
Qt/QML Phidget Library
https://github.com/captemulation/qphidget
Last synced: 10 months ago
JSON representation
Qt/QML Phidget Library
- Host: GitHub
- URL: https://github.com/captemulation/qphidget
- Owner: CaptEmulation
- Created: 2013-08-18T04:46:14.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-25T17:24:41.000Z (over 12 years ago)
- Last Synced: 2023-03-25T13:09:47.566Z (over 3 years ago)
- Language: C++
- Homepage:
- Size: 367 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# QPhidget
Phidgets are a collection of USB powered DAIO (Digital/Analog Input/Output) devices rangings from general purpose input/output to specialized modules such as motor control, motion, environment, touch and eletrical sensors. This project currently supports the basic InterfaceKit module.
## Qt Phidget API
Implementation of the Phidget API exposed as QtObjects
* Event driven
* Translate Phidget events to Qt Signal and Slots mechanism
* QML compatible property bindings
* Unit tests including a mock implemenation of the Phidget21 API
## Usage
### From C++
```
// Create the phidget object
QP888Device *interfaceKit = new QP888Device();
// Connect to one or more signal
QObject::connect(interfaceKit->inputs().at(0), SIGNAL(stateChanged(bool)), this, SLOT(onInput0StateChanged(bool)));
// After opening and once the phidget is connected, signals will begin firing on changes
interfaceKit->open();
```
### From QML
```
import com.soapbubble.qphidget 1.0
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
ifk.output0 = !ifk.output0;
}
}
IFK888 { // QML Item for InterfaceKit 8/8/8
id: ifk
onInput0Changed: {
console.log('Input0: ' + state)
}
}
}
```
## Building
Build has only been tested on Win32 but should be able to compile cross-platform with some additional tweaks to pro files
Requires phidget21 library installed. See http://www.phidgets.com/docs/Programming_Resources for links to download the library.
Build qphidget-lib, then qphidget-qml then qphidget (the root example app)