mirror of
https://gitlab.com/eql/lqml.git
synced 2026-02-07 08:11:48 -08:00
example 'meshtastic': handle faulty bytes from radio; display exact date (tap); revisions
This commit is contained in:
parent
16832a267a
commit
8f42003e36
7 changed files with 37 additions and 13 deletions
|
|
@ -31,6 +31,7 @@
|
|||
(defvar *ready* nil)
|
||||
(defvar *reading* nil)
|
||||
(defvar *received* nil)
|
||||
(defvar *received-faulty* nil)
|
||||
(defvar *schedule-clear* t)
|
||||
|
||||
(defun to-bytes (list)
|
||||
|
|
@ -101,7 +102,7 @@
|
|||
(t
|
||||
(msg:check-utf8-length (q< |text| ui:*edit*))
|
||||
(unless (q< |tooLong| ui:*edit*)
|
||||
(incf msg:*message-id*)
|
||||
(msg:message-id)
|
||||
(when (stringp *receiver*)
|
||||
(setf *receiver* (name-to-node *receiver*)))
|
||||
(send-to-radio
|
||||
|
|
@ -139,10 +140,16 @@
|
|||
(progn
|
||||
(setf *notify-id* bytes)
|
||||
(read-radio))
|
||||
(let ((from-radio (pr:deserialize-from-bytes 'me:from-radio bytes)))
|
||||
(multiple-value-bind (from-radio error)
|
||||
(ignore-errors (pr:deserialize-from-bytes 'me:from-radio bytes))
|
||||
(setf *reading* t)
|
||||
(pr:print-json from-radio)
|
||||
(push from-radio *received*)))
|
||||
(if from-radio
|
||||
(progn
|
||||
(pr:print-json from-radio)
|
||||
(push from-radio *received*))
|
||||
(progn
|
||||
(qlog "received faulty bytes: ~A" error)
|
||||
(push bytes *received-faulty*)))))
|
||||
(values))
|
||||
|
||||
(defun receiving-done () ; see Qt
|
||||
|
|
@ -279,7 +286,7 @@
|
|||
(defun send-admin (admin-message)
|
||||
(send-to-radio
|
||||
(to-radio :to (me:num *my-node-info*)
|
||||
:id (incf msg:*message-id*)
|
||||
:id (msg:message-id)
|
||||
:hop-limit 3
|
||||
:want-ack t
|
||||
:priority :reliable
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
(defvar *message-id* 0)
|
||||
(defvar *states* '(:not-received :sending :received))
|
||||
|
||||
(defun message-id ()
|
||||
(mod (incf *message-id*) #.(expt 2 32)))
|
||||
|
||||
(defun show-message-p (message)
|
||||
(let ((user (app:setting :latest-receiver)))
|
||||
(and user (or (string= user (getf message :receiver))
|
||||
|
|
@ -73,6 +76,12 @@
|
|||
(app:toast (tr "message copied") 2)
|
||||
(values))
|
||||
|
||||
(defun show-date (timestamp) ; see QML
|
||||
(multiple-value-bind (sec min hour day month year)
|
||||
(decode-universal-time (parse-integer timestamp))
|
||||
(app:toast (format nil "~D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D"
|
||||
year month day hour min sec))))
|
||||
|
||||
(defun find-clicked ()
|
||||
(let ((show (not (q< |visible| ui:*find-text*))))
|
||||
(q> |visible| ui:*find-text* show)
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@
|
|||
#:clear-find
|
||||
#:echo-message
|
||||
#:find-text
|
||||
#:message-id
|
||||
#:message-press-and-hold
|
||||
#:receiver-changed
|
||||
#:show-date
|
||||
#:show-messages))
|
||||
|
||||
(defpackage :radios
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ Rectangle {
|
|||
group.setProperty(index, "customName", text)
|
||||
Lisp.call("group:name-edited", model.radioName, text)
|
||||
if (text === "") text = qsTr("Anonym")
|
||||
Qt.callLater(group.sortRenamed, text, index)
|
||||
Qt.callLater(group.sortRenamed, text, index) // 'Qt.callLater': prevent UI thread related crash
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,11 @@ Rectangle {
|
|||
font.family: fontText.name
|
||||
color: "#505050"
|
||||
text: model.hour
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: Lisp.call("msg:show-date", model.timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ Messages
|
|||
The initial view shows the messages between you and a chosen person. You choose
|
||||
the desired person in the **Group** view (swipe to the left).
|
||||
|
||||
To copy a message to the clipboard, simply press-and-hold it.
|
||||
To copy a message to the clipboard, press-and-hold it.
|
||||
|
||||
To see the exact date of a message, tap on its hour.
|
||||
|
||||
The search function (icon on the right) should be intuitive. The search term
|
||||
(case insensitive) is highlighted in red. Tap again on the search icon to leave
|
||||
|
|
@ -115,9 +117,9 @@ any other device.
|
|||
|
||||
The desktop data paths are:
|
||||
|
||||
* Linux: `~/.local/share/cl-meshtastic/data/`
|
||||
* macOS: `~/Library/Application Support/cl-meshtastic/data/`
|
||||
* Windows: TODO
|
||||
* Linux: `/home/<user>/.local/share/cl-meshtastic/data/`
|
||||
* macOS: `/Users/<user>/Library/Application Support/cl-meshtastic/data/`
|
||||
* Windows: `C:\Users\<user>\AppData\Local\cl-meshtastic\data\`
|
||||
|
||||
|
||||
Tips
|
||||
|
|
|
|||
|
|
@ -57,9 +57,8 @@ The macOS version must be compiled first and started from Finder (not the
|
|||
console), otherwise BLE permissions will not work (if run from console, the app
|
||||
will show a BLE exception and consume 100% CPU).
|
||||
|
||||
It should also work on Windows >= 10, but this is not tested yet.
|
||||
|
||||
Since this is WIP, it may currently not work on all platforms (e.g. mobile).
|
||||
It should also work on Windows 10 and later, but the bluetooth part is not
|
||||
tested yet.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue