Issue newline before GB commands (solves issue with console.log and ignored commands)

pull/2831/head
Gordon Williams 2023-06-19 19:19:32 +01:00
parent 69205d3480
commit ba7a2f7996
27 changed files with 64 additions and 31 deletions

View File

@ -25,4 +25,4 @@
0.24: Handle new 'nav' event for navigation
0.25: Added option to 'ignore' an app from the message
0.26: Change handling of GPS status to depend on GPS events instead of connection events
0.27: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -2,7 +2,7 @@
"id": "android",
"name": "Android Integration",
"shortName": "Android",
"version": "0.26",
"version": "0.27",
"description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.",
"icon": "app.png",
"tags": "tool,system,messages,notifications,gadgetbridge",

View File

@ -1,8 +1,6 @@
(function(back) {
function gb(j) {
function gbSend(j) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify(j));
}
var settings = require("Storage").readJSON("android.settings.json",1)||{};
@ -16,8 +14,8 @@
/*LANG*/"Find Phone" : () => E.showMenu({
"" : { "title" : /*LANG*/"Find Phone" },
"< Back" : ()=>E.showMenu(mainmenu),
/*LANG*/"On" : _=>gb({t:"findPhone",n:true}),
/*LANG*/"Off" : _=>gb({t:"findPhone",n:false}),
/*LANG*/"On" : _=>gbSend({t:"findPhone",n:true}),
/*LANG*/"Off" : _=>gbSend({t:"findPhone",n:false}),
}),
/*LANG*/"Keep Msgs" : {
value : !!settings.keep,

View File

@ -1,3 +1,4 @@
0.01: First Version
0.02: Remove HID requirement, update screen
0.03: Fix for Bangle 2, toggle find with top half of screen, exit touch bottom half of screen
0.04: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -20,6 +20,7 @@ function draw() {
}
function findPhone(v) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"findPhone", n:v}));
}

View File

@ -2,7 +2,7 @@
"id": "findphone",
"name": "Find Phone",
"shortName": "Find Phone",
"version": "0.03",
"version": "0.04",
"description": "Find your phone via Gadgetbridge. Click any button to let your phone ring. 📳 Note: The functionality is available even without this app, just go to Settings, App Settings, Gadgetbridge, Find Phone.",
"icon": "app.png",
"tags": "tool,android",

View File

@ -10,3 +10,4 @@
0.10: Simplify touch events
Remove date+time
0.11: Use default Bangle formatter for booleans
0.12: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -415,6 +415,7 @@ let tCommand = {};
* @param {string} command - "play"/"pause"/"next"/"previous"/"volumeup"/"volumedown"
*/
function sendCommand(command) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t: "music", n: command}));
// for control color
if (command in tCommand) {

View File

@ -2,7 +2,7 @@
"id": "gbmusic",
"name": "Gadgetbridge Music Controls",
"shortName": "Music Controls",
"version": "0.11",
"version": "0.12",
"description": "Control the music on your Gadgetbridge-connected phone",
"icon": "icon.png",
"screenshots": [{"url":"screenshot_v1_d.png"},{"url":"screenshot_v1_l.png"},

View File

@ -1 +1,2 @@
0.01: Initial version
0.02: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -22,14 +22,17 @@ var counter = 0; //stores your counted your twists
var tstate = false; //are you ready to count the twists?
function playx() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"music", n:"play"}));
}
function volup() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"music", n:"volumeup"}));
}
function voldn() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"music", n:"volumedown"}));
}

View File

@ -2,7 +2,7 @@
"id": "gbtwist",
"name": "Gadgetbridge Twist Control",
"shortName": "Twist Control",
"version": "0.01",
"version": "0.02",
"description": "Shake your wrist to control your music app via Gadgetbridge",
"icon": "app.png",
"type": "app",

View File

@ -7,3 +7,4 @@
0.07: Update clock_info to avoid a redraw
0.08: Allow swiping to switch triggers
0.09: Improve web interface, arrows in UI
0.10: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -64,6 +64,7 @@ exports.sendTrigger = function(triggerName){
while(retries > 0){
try{
// Now lets send the trigger that we sould send.
Bluetooth.println("");
Bluetooth.println(JSON.stringify({
t:"intent",
action:"com.espruino.gadgetbridge.banglejs.HA",

View File

@ -1,7 +1,7 @@
{
"id": "ha",
"name": "Home Assistant",
"version": "0.09",
"version": "0.10",
"description": "Integrates your Bangle.js into Home Assistant.",
"icon": "ha.png",
"type": "app",

View File

@ -13,3 +13,4 @@
0.13: Fix drawPyramid function so pyramids are drawn in correct Y position
0.14: Add jumping frame for characters
0.15: Disable notification buzz during Quiet Mode
0.16: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -92,6 +92,7 @@ function writeSettings(newSettings) {
}
function phoneOutbound(msg) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify(msg));
}

View File

@ -1,7 +1,7 @@
{
"id": "marioclock",
"name": "Mario Clock",
"version": "0.15",
"version": "0.16",
"description": "Animated retro Mario clock, with Gameboy style 8-bit grey-scale graphics.",
"icon": "marioclock.png",
"type": "clock",

View File

@ -10,3 +10,4 @@
0.12: Improve README, option to add functions triggered by status changes or time periods, remove old log (<0.10) conversion
0.13: Prevent to stay in consecutive sleep if not worn, correct trigger calling, add trigger object itself as argument to the fn function
0.14: Add "Delete all logfiles before" to interface.html, display all logfiles in the interface
0.15: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -303,6 +303,7 @@ if (sleeplog.conf.enabled) {
// send status to gadgetbridge
var gb_kinds = "unknown,not_worn,activity,light_sleep,deep_sleep";
Bluetooth.println("");
Bluetooth.println(JSON.stringify({
t: "act",
act: gb_kinds.split(",")[data.status],

View File

@ -2,7 +2,7 @@
"id":"sleeplog",
"name":"Sleep Log",
"shortName": "SleepLog",
"version": "0.14",
"version": "0.15",
"description": "Log and view your sleeping habits. This app is using the built in movement calculation.",
"icon": "app.png",
"type": "app",

View File

@ -6,3 +6,4 @@
0.06: Make compatible with Fastload Utils app.
0.07: Remove just the specific listeners to not interfere with Quick Launch
when fastloading.
0.08: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -156,75 +156,93 @@ let albumSearchTerm = function() { // input album to search for
let searchPlayWOTags = function() {//make a spotify search and play using entered terms
searchString = simpleSearch;
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let searchPlayWTags = function() {//make a spotify search and play using entered terms
searchString = (artist=="" ? "":("artist:\""+artist+"\"")) + ((artist!="" && track!="") ? " ":"") + (track=="" ? "":("track:\""+track+"\"")) + (((artist!="" && album!="") || (track!="" && album!="")) ? " ":"") + (album=="" ? "":(" album:\""+album+"\""));
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:searchString}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let playVreden = function() {//Play the track "Vreden" by Sara Parkman via spotify uri-link
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let playVredenAlternate = function() {//Play the track "Vreden" by Sara Parkman via spotify uri-link
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:track:5QEFFJ5tAeRlVquCUNpAJY:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let searchPlayVreden = function() {//Play the track "Vreden" by Sara Parkman via search and play
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'artist:"Sara Parkman" track:"Vreden"'}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let openAlbum = function() {//Play EP "The Blue Room" by Coldplay
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:album:3MVb2CWB36x7VwYo5sZmf2", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let searchPlayAlbum = function() {//Play EP "The Blue Room" by Coldplay via search and play
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.media.action.MEDIA_PLAY_FROM_SEARCH", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", target:"activity", extra:{query:'album:"The blue room" artist:"Coldplay"', "android.intent.extra.focus":"vnd.android.cursor.item/album"}, flags:["FLAG_ACTIVITY_NEW_TASK"]}));
};
let spotifyWidget = function(action) {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:("com.spotify.mobile.android.ui.widget."+action), package:"com.spotify.music", target:"broadcastreceiver"}));
};
let gadgetbridgeWake = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", target:"activity", flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_CLEAR_TASK", "FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS", "FLAG_ACTIVITY_NO_ANIMATION"], package:"gadgetbridge", class:"nodomain.freeyourgadget.gadgetbridge.activities.WakeActivity"}));
};
let spotifyPlaylistDW = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXcRfaeEbxXIgb:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM1 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E365VyzxE0mxF:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM2 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E38LZHLFnrM61:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM3 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36RU87qzgBFP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM4 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E396gGyCXEBFh:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM5 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E37a0Tt6CKJLP:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDM6 = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1E36UIQLQK79od:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistDD = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZF1EfWFiI7QfIAKq:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};
let spotifyPlaylistRR = function() {
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"intent", action:"android.intent.action.VIEW", categories:["android.intent.category.DEFAULT"], package:"com.spotify.music", data:"spotify:user:spotify:playlist:37i9dQZEVXbs0XkE2V8sMO:play", target:"activity" , flags:["FLAG_ACTIVITY_NEW_TASK", "FLAG_ACTIVITY_NO_ANIMATION"/*, "FLAG_ACTIVITY_CLEAR_TOP", "FLAG_ACTIVITY_PREVIOUS_IS_TOP"*/]}));
};

View File

@ -1,7 +1,7 @@
{
"id": "spotrem",
"name": "Remote for Spotify",
"version": "0.07",
"version": "0.08",
"description": "Control spotify on your android device.",
"readme": "README.md",
"type": "app",

View File

@ -1 +1,2 @@
0.01: first version
0.02: Issue newline before GB commands (solves issue with console.log and ignored commands)

View File

@ -3,7 +3,7 @@
"shortName":"AGPS Widget",
"icon": "widget.png",
"type": "widget",
"version":"0.01",
"version":"0.02",
"description": "Once installed, this widget allows your Bangle.js 2 to load AGPS data in the background **via Gadgetbridge on an Android phone** so it is always up to date. If you just want to upload the latest AGPS data from this app loader, please use the `Assisted GPS Update (AGPS)` app.",
"readme": "README.md",
"tags": "widget,agps,http",

View File

@ -127,6 +127,7 @@ g.drawImage(atob("FBQBAAAABgAAYAAPAACwABOAATgAI8ACPABD4AQ+AEPgD8EAg/AQP4AD+CD/wj
isRequesting = true;
if (Bluetooth.println) {
console.log("On device");
Bluetooth.println("");
Bluetooth.println(JSON.stringify({t:"http", url:"https://www.espruino.com/agps/casic.base64"}));
}
else {