發表文章

目前顯示的是 12月 6, 2018的文章

Receive asynchronous data in javascript

圖片
up vote 2 down vote favorite I'm using an Linux embedded device that can only run QML/Javascript items. There are no compilers available, no Python, no curl, no Node.js, no package managers ... But I can write bash scripts. I need to send asynchronous data from a bash script to the QML/JS objects. Until now I did the opposite: the JS reads a file created from the bash script: Bash script: #!/bin/bash stty -F /dev/ttyS1 115200 -echo echo "Receiver is listening..." file="/dev/ttyS1" while read -r line; do echo "$line" target=$line:0:1 echo "$target" if [ "$target" = "C" ]; then echo "$line#?" > /tmp/file1 elif [ "$target" = "D" ]; then echo "$line#?" > /tmp/file2 fi done < "$file" QML/JS: function request(url, callback) var xhr = new XMLHttpRequest(); var timer = Qt.createQmlObject("import QtQuick 1.1; Timer interval: 500; repeat: false; ru...

Helicopter

圖片
"Helicopters" redirects here. For other uses, see Helicopter (disambiguation). Type of rotor craft in which lift and thrust are supplied by rotors A Bell 206 helicopter of the Los Angeles Police Department A helicopter is a type of rotorcraft in which lift and thrust are supplied by rotors. This allows the helicopter to take off and land vertically, to hover, and to fly forward, backward, and laterally. These attributes allow helicopters to be used in congested or isolated areas where fixed-wing aircraft and many forms of VTOL (vertical takeoff and landing) aircraft cannot perform. The English word helicopter is adapted from the French word hélicoptère , coined by Gustave Ponton d'Amécourt in 1861, which originates from the Greek helix ( ἕλιξ ) "helix, spiral, whirl, convolution" [1] and pteron ( πτερόν ) "wing". [2] [3] [4] [5] English language nicknames for helicopter include "chopper", "copter", "helo", "hel...