This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onEventMainThread(ByteBuffer frameBuf) { | |
byte[] frame = frameBuf.array(); | |
byte cmd = frame[4]; | |
SLOG.LogByteArr(TAG, frame, frame.length); | |
if (cmd == 33) { | |
Log.m941i("find", "查寻反回基本参数"); | |
SLOG.LogByteArr("find", frame, frame.length); | |
decodeAlarmAgrsProc(frame[6], frame[7], frame[8]); | |
} else if (cmd == 17) { | |
Log.m941i(TAG, "是握手了"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo add-apt-repository ppa:webupd8team/java -y | |
sudo apt-get update | |
sudo apt --assume-yes install oracle-java8-installer | |
java -version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function (request, context) { | |
if (request.directive.header.namespace === 'Alexa.Discovery' && request.directive.header.name === 'Discover') { | |
//log("DEBUG:", "Discover request", JSON.stringify(request)); | |
//handleDiscovery(request, context, ""); | |
console.log("Olá discovery") | |
} | |
else if (request.directive.header.namespace === 'Alexa.PowerController') { | |
if (request.directive.header.name === 'TurnOn' || request.directive.header.name === 'TurnOff') { | |
log("DEBUG:", "TurnOn or TurnOff Request", JSON.stringify(request)); | |
handlePowerControl(request, context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pgp = require('pg-promise')({}); | |
const db = pgp(process.env.DATABASE_URL); | |
/* | |
* Get access token. | |
*/ | |
module.exports.getAccessToken = function(bearerToken) { | |
return db.query('SELECT otk_token_acesso, otk_token_expira_em, otk_ocl_id, otk_refresh_token, otk_refresh_token_expira_em, otk_usr_id FROM otk_oauth_tokens WHERE otk_token_acesso = $1', [bearerToken]) | |
.then(function(result) { |