code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
console.log('pwm: pwm requre ') var pwm = require('pwm'); console.log('pwm: pwm test open ') var pwm1 = pwm.open({ id: 'pwm1', success: function() { console.log('pwm: open pwm success') }, fail: function() { console.log('pwm: open pwm failed') } }); var freq = pwm1.getOption().freq var duty = pwm1.g...
YifuLiu/AliOS-Things
components/amp/example-js/common/pwm.js
JavaScript
apache-2.0
1,118
var rtc = require('rtc'); rtc.start(); var current_time = rtc.getTime(); console.log('rtc1: current time is ' + current_time); var my_date = new Date(); my_date.setFullYear(2008,7,9); rtc.setTime(my_date); console.log('Date is ' + my_date.toUTCString()); current_time = rtc.getTime(); console.log('rtc2: current t...
YifuLiu/AliOS-Things
components/amp/example-js/common/rtc.js
JavaScript
apache-2.0
359
var spi = require('spi'); var msgbuf = [0x10, 0xee] // led灯 var sensor = spi.open({ id: 'spi', success: function() { console.log('open spi success') }, fail: function() { console.log('open spi failed') } }); sensor.write(msgbuf) var value = sensor.read(2) console.log('sensor value is ' + value) s...
YifuLiu/AliOS-Things
components/amp/example-js/common/spi.js
JavaScript
apache-2.0
336
console.log('system version is: ' + system.version()) console.log('system platform is: ' + system.platform()) console.log('system uptime is: ' + system.uptime()) console.log('system heapTotal is: ' + system.memory().heapTotal) console.log('system heapUsed is: ' + system.memory().heapUsed)
YifuLiu/AliOS-Things
components/amp/example-js/common/system.js
JavaScript
apache-2.0
290
var tcp = require('tcp'); function onConnect() { tcpClient.send({ message: 'hello, this is tcp client test', success: function() { console.log('tcp send success'); }, fail: function() { console.log('tcp send failed'); } }); } var tcpClient = tcp.createClient({ host: '47.101.151.11...
YifuLiu/AliOS-Things
components/amp/example-js/common/tcp.js
JavaScript
apache-2.0
858
var uart = require('uart'); var msgbuf = 'this is amp uart test' // led灯 var serial = uart.open({ id: 'serial', success: function() { console.log('open spi success') }, fail: function() { console.log('open spi failed') } }); serial.write(msgbuf) var value = serial.read() console.log('sensor value i...
YifuLiu/AliOS-Things
components/amp/example-js/common/uart.js
JavaScript
apache-2.0
471
var udp = require('udp'); var udpSocket = udp.createSocket(); function arrayToString(fileData) { var dataString = ""; for (var i = 0; i < fileData.length; i++) { dataString += String.fromCharCode(fileData[i]); } return dataString; } udpSocket.on('message', function(data, rinfo) { console.l...
YifuLiu/AliOS-Things
components/amp/example-js/common/udp.js
JavaScript
apache-2.0
922
var dog = require('wdg'); // led灯 dog.start(2000); dog.feed(); dog.stop();
YifuLiu/AliOS-Things
components/amp/example-js/common/wdg.js
JavaScript
apache-2.0
79
console.log('wifi info get test') WIFI.connect("aiot", "iot123456", function(){ console.log('wifi connect'); }); var ssid = WIFI.getInfo().ssid; var ip = WIFI.getInfo().ip; var mac = WIFI.getInfo().mac; var rssi = WIFI.getInfo().rssi; console.log('ssid is ' + ssid); console.log('ip is ' + ip); console.log('mac i...
YifuLiu/AliOS-Things
components/amp/example-js/common/wifi.js
JavaScript
apache-2.0
383
var gpio = require('gpio'); /* open GPIO KEY1 */ var KEY1 = gpio.open({ id: 'KEY1', success: function() { console.log('gpio: open KEY1 success') }, fail: function() { console.log('gpio: open KEY1 failed') } }); /* read KEY1 input every 1 second */ var value; setInterval(function() { value = KEY1.r...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/gpio/input/app.js
JavaScript
apache-2.0
390
var gpio = require('gpio'); /* open GPIO KEY1 */ var KEY1 = gpio.open({ id: 'KEY1', success: function() { console.log('gpio: open KEY1 success') }, fail: function() { console.log('gpio: open KEY1 failed') } }); KEY1.onIRQ({ cb: function() { console.log('gpio: KEY1 interrupt happens'); } });
YifuLiu/AliOS-Things
components/amp/example-js/haas100/gpio/interrupt/app.js
JavaScript
apache-2.0
317
var gpio = require('gpio'); /* open GPIO LED1 */ var LED1 = gpio.open({ id: 'L1', success: function() { console.log('gpio: open LED1 success') }, fail: function() { console.log('gpio: open LED1 failed') } }); /* open GPIO LED1 */ var LED2 = gpio.open({ id: 'L2', success: function() { console...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/gpio/output/app.js
JavaScript
apache-2.0
1,312
import * as mb from './modbus.js'; var deviceAddr = 1; var device = mb.Modbus( { id: 'UART1' }, { id: 'D13', polarity: 1 }, deviceAddr ); /* read single coil */ setInterval(() => { device.read(deviceAddr, 'hr501-555', 1000).then((result) => { console.log('read data ' + result) }).catch((r...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/modbus/app.js
JavaScript
apache-2.0
387
import * as Uart from 'uart' import * as events from 'events' import * as Gpio from 'gpio' function Modbus(uartPort, dirPort) { var rtn = {} var lastTid = 1 rtn.readTimeout = 500; rtn.readTimeouthandler; rtn.packetBufferLength = 100 rtn.packets = [] rtn.stream = Serial(uartPort...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/modbus/modbus.js
JavaScript
apache-2.0
12,197
var network = require('network'); var net = network.openNetWorkClient({devType: 'ethnet'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ console.log('net sta...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/network/ethernet/app.js
JavaScript
apache-2.0
1,867
var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ console.log('net statu...
YifuLiu/AliOS-Things
components/amp/example-js/haas100/network/wifi/app.js
JavaScript
apache-2.0
2,146
var wdg = require('wdg'); //start wdg wdg.start(2000); // feed wdg wdg.feed(); // stop wdg wdg.stop();
YifuLiu/AliOS-Things
components/amp/example-js/haas100/wdg/app.js
JavaScript
apache-2.0
114
import * as adc from 'adc' var vbattery = adc.open({ id: 'ADC0', success: function () { console.log('adc: open adc success') }, fail: function () { console.log('adc: open adc failed') } }); var value = vbattery.readValue() console.log('adc value is ' + value)
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/adc/app.js
JavaScript
apache-2.0
298
import * as checksum from 'checksum' let check_param = { 'src': '000102030405060708090a0b0c0d0e0f' } let crc16_result = checksum.crc16(check_param); console.log('crc16:'+crc16_result) let crc32_result = checksum.crc32(check_param); console.log('crc32:'+crc32_result) let md5 = checksum.md5(check_param); console....
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/checksum/app.js
JavaScript
apache-2.0
335
var device = require('device'); var token = device.getToken(); var value = '1234567890abc'; if (token === undefined) { console.log('found no token in kv, write new token.'); device.setToken(value); console.log('write token: ' + value); if (value === device.getToken()) { console.log('read token a...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/device/app.js
JavaScript
apache-2.0
427
var fs = require('fs'); /* HaaS100/EDU K1/200的文件路径必须以/data/开始,其他硬件待确认。*/ var path = '/data/test.data'; var content = 'this is javascript fs test file'; /** filesystem total size */ console.log('fs total size: ' + fs.totalSize()); /** write file */ fs.writeSync(path, content); console.log('fs write: ' + content); /*...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/fs/app.js
JavaScript
apache-2.0
671
var gpio = require('gpio'); /* open GPIO KEY1 */ var KEY1 = gpio.open({ id: 'KEY1', success: function() { console.log('gpio: open KEY1 success') }, fail: function() { console.log('gpio: open KEY1 failed') } }); /* read KEY1 input every 1 second */ var value; setInterval(function() { value = KEY1.r...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/gpio/input/app.js
JavaScript
apache-2.0
390
var gpio = require('gpio'); /* open GPIO KEY1 */ var KEY2 = gpio.open({ id: 'KEY2', success: function() { console.log('gpio: open KEY2 success') }, fail: function() { console.log('gpio: open KEY2 failed') } }); KEY2.onIRQ({ cb: function() { console.log('gpio: KEY2 interrupt happens'); } });
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/gpio/interrupt/app.js
JavaScript
apache-2.0
317
var gpio = require('gpio'); /* open GPIO LED1 */ var LED1 = gpio.open({ id: 'L1', success: function() { console.log('gpio: open LED1 success') }, fail: function() { console.log('gpio: open LED1 failed') } }); /* toggle LED1 every 1 second */ var value = 1; setInterval(function() { value = 1 - valu...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/gpio/output/app.js
JavaScript
apache-2.0
408
// app.js import * as i2c from 'i2c'; // 初始化对应的I2C var sensor = i2c.open({ id: 'sensor', success: function () { // 初始化成功 console.log('open i2c success') }, fail: function () { // 初始化失败 console.log('open i2c failed') } }); setInterval(function () { // 切换成温度模式 sensor.write([0xF3]); sleep...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/i2c/app.js
JavaScript
apache-2.0
1,193
var network = require('network'); var iot = require('iot'); var net = network.openNetWorkClient({devType: 'wifi'}); /** * 获取网络类型 * 目前支持两种类型:wifi cellular(蜂窝网) */ var netType = net.getType(); console.log('net type is: ' + netType); /** * 获取网络状态 * 目前支持两种状态:connect disconnect */ var netStatus = net.getStatu...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/iot/iot-device/sanyuanzu/app.js
JavaScript
apache-2.0
3,451
var kv = require('kv'); var network = require('network'); var iot = require('iot'); var net = network.openNetWorkClient({devType: 'wifi'}); var iotdev; var lightSwitch = 0; var errCode = 0; var ds; var dynregParams = { productKey: 'xx', // 请替换为自己的product key deviceName: 'xx', // 请替换为自己板子的deviceN...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/iot/iot-device/wl-dynreg/app.js
JavaScript
apache-2.0
4,677
var iot = require('iot'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var productKey = 'xxx'; // 请替换成自己网关设备的pk var deviceName = 'xxx'; // 请替换成自己网关设备的dn var deviceSecret = 'xxx'; // 请替换成自己网关设备的ds var lightSwitch = 0; var gateway; var subdev = [ ...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/iot/iot-gateway/sanyuanzu/app.js
JavaScript
apache-2.0
4,512
var iot = require('iot'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var productKey = 'xxx'; // 替换成用户网关的pk var deviceName = 'xxx-01'; // 替换成用户网关的dn var deviceSecret = 'xxx'; // 替换成用户网关的ds var lightSwitch = 0; var gateway; var subdev = [ { productKey: ...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/iot/iot-gateway/wl-dynreg/app.js
JavaScript
apache-2.0
4,676
var kv = require('kv'); var key = 'key-test'; var value = 'this is amp kv test file'; // kv set kv.setStorageSync(key, value); // kv get var val = kv.getStorageSync(key); console.log('kv read: ' + val); // kv remove kv.removeStorageSync(key);
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/kv/app.js
JavaScript
apache-2.0
246
import * as ulog from 'ulog' //set local terminal output log level to debug ulog.stdloglevel('debug') //set local log file log level info ulog.fsloglevel('warning') //set local file save path ulog.setlogfilepath('/data/ulog/') //set log fize size to 8k ulog.setlogfilesize(8192) //ulog.cloudloglevel('info') ulog.d...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/log/app.js
JavaScript
apache-2.0
474
var network = require('network'); var net = network.openNetWorkClient({devType: 'cellular'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ console.log('net s...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/cellular/app.js
JavaScript
apache-2.0
1,779
var http = require('http'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); /* 加载 timer 模块 */ var timer = require('timer'); var timer0 = timer.open({ id: 'TIMER0' }); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); ...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/http/http_download/app.js
JavaScript
apache-2.0
2,892
var http = require('http'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 *...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/http/http_get/app.js
JavaScript
apache-2.0
2,559
var http = require('http'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 *...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/http/http_post/app.js
JavaScript
apache-2.0
2,669
var mqtt = require('mqtt'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 *...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/mqtt/app.js
JavaScript
apache-2.0
3,521
var tcp = require('tcp'); var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ ...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/tcp/app.js
JavaScript
apache-2.0
3,309
var udp = require('udp'); var udpSocket = udp.createSocket(); // bind port udpSocket.bind(8061); udpSocket.on('send', function() { console.log('udp data send'); }); udpSocket.on('message', function(data, rinfo) { console.log('receive data from ' + rinfo.host + ' port: ' + rinfo.port); console.log('udp socket ...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/udp/app.js
JavaScript
apache-2.0
619
var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ console.log('net statu...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/network/wifi/app.js
JavaScript
apache-2.0
2,146
import * as pwm from 'pwm' import * as timer from 'timer' console.log('pwm: pwm test open ') var pwm0 = pwm.open({ id: 'PWM0', success: function() { console.log('pwm: open pwm0 success') }, fail: function() { console.log('pwm: open pwm0 failed') } }); var timer0 = timer.open({ id: 'TIMER0' })...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/pwm/app.js
JavaScript
apache-2.0
1,110
import * as spi from 'spi' import * as gpio from 'gpio' import SH1106 from './sh1106.js' var oled_spi = spi.open({ id: "oled_spi" }); var oled_dc = gpio.open({ id: "oled_dc" }); var oled_res = gpio.open({ id: "oled_res" }); var dispaly = new SH1106(132, 64, oled_spi, oled_dc, oled_res, undefined) dispaly.open() var...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/spi/app.js
JavaScript
apache-2.0
642
const SET_SCAN_DIR = 0xc0 const LOW_COLUMN_ADDRESS = 0x00 const HIGH_COLUMN_ADDRESS = 0x10 const SET_PAGE_ADDRESS = 0xB0 const SET_CONTRAST = 0x81 const SET_ENTIRE_ON = 0xa4 const SET_NORM_INV = 0xa6 const SET_DISP = 0xae const SET_MEM_ADDR = 0x20 const SET_DISP_START_LINE = 0x40 const SET_SEG_REMAP = 0xa0 const SET_MU...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/spi/sh1106.js
JavaScript
apache-2.0
7,455
console.log('system versions().module is: ' + system.versions().module) console.log('system version is: ' + system.version()) console.log('system appversion is: ' + system.appversion()) console.log('system getSystemInfo().userjsVersion is: ' + system.getSystemInfo().userjsVersion) console.log('system getSystemInfo().ap...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/system/app.js
JavaScript
apache-2.0
1,143
/* 加载 timer 模块 */ var timer = require('timer'); /* 创建 timer 实例 */ var timer0 = timer.open({ id: 'TIMER0' }); console.log('HardWare Timer Test'); /* 定义用来统计触发次数的变量 */ var count = 0; /* 定义定时到期回调函数,单次触发打印一行字符串及触发次数 */ function timeout_cb() { console.log('Timer0 Timeout count' + count); count++; } /* 设置单次定时,定...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/timer/one-shot-timer/app.js
JavaScript
apache-2.0
529
/* 加载 timer 模块 */ var timer = require('timer'); /* 创建 timer 实例 */ var timer0 = timer.open({ id: 'TIMER0' }); console.log('HardWare Timer Test'); /* 定义用来统计触发次数的变量 */ var count = 0; /* 定义定时器周期回调函数,每次触发打印一行字符串及触发次数 */ function interval_cb() { console.log('Timer0 Interval count' + count); count++; } /* 设置周期性...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/timer/repeat-timer/app.js
JavaScript
apache-2.0
539
import * as uart from 'uart' var msgbuf = 'this is amp uart test' function ab2str(buf) { return String.fromCharCode.apply(null, new Uint8Array(buf)); } console.log('please short haaseduk1 UART2_TXD & UART2_RXD to finish this test !!!') var serial = uart.open({ id: 'serial', success: function() { console.lo...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/uart/app.js
JavaScript
apache-2.0
639
var wdg = require('wdg'); //start wdg wdg.start(2000); // feed wdg wdg.feed(); // stop wdg wdg.stop();
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/wdg/app.js
JavaScript
apache-2.0
114
var network = require('network'); var net = network.openNetWorkClient({devType: 'wifi'}); var netType = net.getType(); console.log('net type is: ' + netType); var netStatus = net.getStatus(); console.log('net status is: ' + netStatus); if (netStatus == 'connect') { /* 网络状态已连接,获取网络状态 */ console.log('net statu...
YifuLiu/AliOS-Things
components/amp/example-js/haaseduk1/wifi/app.js
JavaScript
apache-2.0
2,146
/* * Copyright (C) 2015-2021 Alibaba Group Holding Limited */ #include "stdlib.h" #include <aos/kernel.h> #ifdef AOS_COMP_CLI #include "aos/cli.h" #endif extern int amp_main(void); static void amp_entry(void * arg) { int ret; (void *)arg; ret = amp_main(); if (ret != 0) { printf("start amp ...
YifuLiu/AliOS-Things
components/amp/example/amp_example.c
C
apache-2.0
771
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_adc_size = 691; const uint8_t jslib_adc[691] = { 0x01, 0x0f, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x61, 0x64, 0x63, 0x2e, 0x6a, 0x73, 0x06, 0x41, 0x44, 0x43, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0c, 0x48, 0x57, 0x5f, 0x41,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_adc.c
C
apache-2.0
4,392
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_appota_size = 840; const uint8_t jslib_appota[840] = { 0x01, 0x18, 0x1a, 0x73, 0x72, 0x63, 0x2f, 0x61, 0x70, 0x70, 0x6f, 0x74, 0x61, 0x2e, 0x6a, 0x73, 0x0c, 0x41, 0x50, 0x50, 0x4f, 0x54, 0x41, 0x0c, 0x65, 0x76,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_appota.c
C
apache-2.0
5,310
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_audioplayer_size = 1317; const uint8_t jslib_audioplayer[1317] = { 0x01, 0x20, 0x24, 0x73, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6a, 0x73, 0x0c, 0x65, 0x76, ...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_audioplayer.c
C
apache-2.0
8,244
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_audiorecorder_size = 712; const uint8_t jslib_audiorecorder[712] = { 0x01, 0x12, 0x28, 0x73, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x6a, 0x73, 0x0c...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_audiorecorder.c
C
apache-2.0
4,540
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_bt_host_size = 2574; const uint8_t jslib_bt_host[2574] = { 0x01, 0x3a, 0x1c, 0x73, 0x72, 0x63, 0x2f, 0x62, 0x74, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6a, 0x73, 0x0e, 0x42, 0x54, 0x5f, 0x48, 0x4f, 0x53, 0x54, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_bt_host.c
C
apache-2.0
15,935
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_crypto_size = 455; const uint8_t jslib_crypto[455] = { 0x01, 0x0e, 0x1a, 0x73, 0x72, 0x63, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x6a, 0x73, 0x0c, 0x43, 0x52, 0x59, 0x50, 0x54, 0x4f, 0x0e, 0x65, 0x6e,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_crypto.c
C
apache-2.0
2,952
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_dac_size = 835; const uint8_t jslib_dac[835] = { 0x01, 0x12, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x64, 0x61, 0x63, 0x2e, 0x6a, 0x73, 0x06, 0x44, 0x41, 0x43, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0c, 0x48, 0x57, 0x5f, 0x44,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_dac.c
C
apache-2.0
5,274
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_device_size = 544; const uint8_t jslib_device[544] = { 0x01, 0x12, 0x1a, 0x73, 0x72, 0x63, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x6a, 0x73, 0x04, 0x6b, 0x76, 0x1a, 0x73, 0x65, 0x74, 0x44, 0x65, 0x76,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_device.c
C
apache-2.0
3,497
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_ds18b20_size = 594; const uint8_t jslib_ds18b20[594] = { 0x01, 0x12, 0x2e, 0x2e, 0x2e, 0x2f, 0x6a, 0x73, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2f, 0x64, 0x73, 0x31, 0x38, 0x62, 0x32, 0x30, 0x2e, 0x6a, 0x7...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_ds18b20.c
C
apache-2.0
3,806
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_events_size = 5023; const uint8_t jslib_events[5023] = { 0x01, 0x61, 0x1a, 0x73, 0x72, 0x63, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x6a, 0x73, 0x18, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x45, 0x6d, 0x69, 0x7...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_events.c
C
apache-2.0
30,933
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_fs_size = 627; const uint8_t jslib_fs[627] = { 0x01, 0x13, 0x12, 0x73, 0x72, 0x63, 0x2f, 0x66, 0x73, 0x2e, 0x6a, 0x73, 0x04, 0x46, 0x53, 0x12, 0x77, 0x72, 0x69, 0x74, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x72, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_fs.c
C
apache-2.0
3,998
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_gpio_size = 1041; const uint8_t jslib_gpio[1041] = { 0x01, 0x17, 0x16, 0x73, 0x72, 0x63, 0x2f, 0x67, 0x70, 0x69, 0x6f, 0x2e, 0x6a, 0x73, 0x08, 0x47, 0x50, 0x49, 0x4f, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0e, 0x48, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_gpio.c
C
apache-2.0
6,540
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_i2c_size = 1226; const uint8_t jslib_i2c[1226] = { 0x01, 0x1c, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x69, 0x32, 0x63, 0x2e, 0x6a, 0x73, 0x06, 0x49, 0x32, 0x43, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0c, 0x48, 0x57, 0x5f, 0x4...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_i2c.c
C
apache-2.0
7,671
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_iot_size = 4813; const uint8_t jslib_iot[4813] = { 0x01, 0x51, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x69, 0x6f, 0x74, 0x2e, 0x6a, 0x73, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x16, 0x41, 0x49, 0x4f, 0x54, 0x5f, 0x4...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_iot.c
C
apache-2.0
29,641
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_location_size = 1487; const uint8_t jslib_location[1487] = { 0x01, 0x27, 0x1e, 0x73, 0x72, 0x63, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6a, 0x73, 0x06, 0x73, 0x74, 0x64, 0x0e, 0x4e, 0x45,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_location.c
C
apache-2.0
9,279
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_mqtt_size = 2364; const uint8_t jslib_mqtt[2364] = { 0x01, 0x36, 0x16, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x71, 0x74, 0x74, 0x2e, 0x6a, 0x73, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x08, 0x4d, 0x51, 0x54, 0x54, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_mqtt.c
C
apache-2.0
14,643
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_netmgr_size = 2301; const uint8_t jslib_netmgr[2301] = { 0x01, 0x39, 0x1a, 0x73, 0x72, 0x63, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x67, 0x72, 0x2e, 0x6a, 0x73, 0x0c, 0x4e, 0x45, 0x54, 0x4d, 0x47, 0x52, 0x0c, 0x65, 0x7...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_netmgr.c
C
apache-2.0
14,261
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_network_size = 3775; const uint8_t jslib_network[3775] = { 0x01, 0x52, 0x1c, 0x73, 0x72, 0x63, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6a, 0x73, 0x06, 0x73, 0x74, 0x64, 0x0c, 0x65, 0x76, 0x65, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_network.c
C
apache-2.0
23,291
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_onewire_size = 988; const uint8_t jslib_onewire[988] = { 0x01, 0x13, 0x1c, 0x73, 0x72, 0x63, 0x2f, 0x6f, 0x6e, 0x65, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x6a, 0x73, 0x0e, 0x4f, 0x4e, 0x45, 0x57, 0x49, 0x52, 0x45, 0x0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_onewire.c
C
apache-2.0
6,219
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_pwm_size = 941; const uint8_t jslib_pwm[941] = { 0x01, 0x14, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x70, 0x77, 0x6d, 0x2e, 0x6a, 0x73, 0x06, 0x50, 0x57, 0x4d, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0c, 0x48, 0x57, 0x5f, 0x50,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_pwm.c
C
apache-2.0
5,923
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_repl_size = 19852; const uint8_t jslib_repl[19852] = { 0x01, 0xdd, 0x03, 0x16, 0x73, 0x72, 0x63, 0x2f, 0x72, 0x65, 0x70, 0x6c, 0x2e, 0x6a, 0x73, 0x06, 0x73, 0x74, 0x64, 0x04, 0x6f, 0x73, 0x08, 0x52, 0x45, 0x50,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_repl.c
C
apache-2.0
121,759
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_rtc_size = 682; const uint8_t jslib_rtc[682] = { 0x01, 0x19, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x72, 0x74, 0x63, 0x2e, 0x6a, 0x73, 0x06, 0x52, 0x54, 0x43, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x0e, 0x73, 0x65, 0x74,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_rtc.c
C
apache-2.0
4,337
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_spi_size = 1188; const uint8_t jslib_spi[1188] = { 0x01, 0x1b, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x73, 0x70, 0x69, 0x2e, 0x6a, 0x73, 0x06, 0x53, 0x50, 0x49, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x0c, 0x48, 0x57, 0x5f, 0x5...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_spi.c
C
apache-2.0
7,438
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_tcp_size = 1792; const uint8_t jslib_tcp[1792] = { 0x01, 0x28, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x6a, 0x73, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x06, 0x54, 0x43, 0x50, 0x18, 0x63, 0x7...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_tcp.c
C
apache-2.0
11,137
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_uart_size = 1451; const uint8_t jslib_uart[1451] = { 0x01, 0x22, 0x16, 0x73, 0x72, 0x63, 0x2f, 0x75, 0x61, 0x72, 0x74, 0x2e, 0x6a, 0x73, 0x08, 0x55, 0x41, 0x52, 0x54, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_uart.c
C
apache-2.0
9,051
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_udp_size = 1347; const uint8_t jslib_udp[1347] = { 0x01, 0x25, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x75, 0x64, 0x70, 0x2e, 0x6a, 0x73, 0x06, 0x55, 0x44, 0x50, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x63, 0x7...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_udp.c
C
apache-2.0
8,412
/* File generated automatically by the QuickJS compiler. */ #include <inttypes.h> const uint32_t jslib_wdg_size = 268; const uint8_t jslib_wdg[268] = { 0x01, 0x07, 0x14, 0x73, 0x72, 0x63, 0x2f, 0x77, 0x64, 0x67, 0x2e, 0x6a, 0x73, 0x06, 0x57, 0x44, 0x47, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x08, 0x66, 0x65, 0x65,...
YifuLiu/AliOS-Things
components/amp/jslib/bytecode/jslib_wdg.c
C
apache-2.0
1,801
.\qjsc.exe -c -m -M GPIO -N jslib_gpio -o bytecode\jslib_gpio.c src\gpio.js .\qjsc.exe -c -m -N jslib_events -o bytecode\jslib_events.c src\events.js .\qjsc.exe -c -m -M events -M CRYPTO -N jslib_crypto -o bytecode\jslib_crypto.c src\crypto.js .\qjsc.exe -c -m -M events -M APPOTA -N jslib_appota -o bytecode\jslib_appot...
YifuLiu/AliOS-Things
components/amp/jslib/gen_bytecode.bat
Batchfile
apache-2.0
1,484
./qjsc_linux -c -m src/gpio.js -N jslib_gpio -M GPIO -o bytecode/jslib_gpio.c ./qjsc_linux -c -m src/events.js -N jslib_events -o bytecode/jslib_events.c ./qjsc_linux -c -m src/crypto.js -N jslib_crypto -M events -M CRYPTO -o bytecode/jslib_crypto.c ./qjsc_linux -c -m src/appota.js -N jslib_appota -M events -M APPOTA -...
YifuLiu/AliOS-Things
components/amp/jslib/gen_bytecode_linux.sh
Shell
apache-2.0
1,590
./qjsc_macos -c -m -M GPIO -N jslib_gpio -o bytecode/jslib_gpio.c src/gpio.js ./qjsc_macos -c -m -N jslib_events -o bytecode/jslib_events.c src/events.js ./qjsc_macos -c -m -M events -M CRYPTO -N jslib_crypto -o bytecode/jslib_crypto.c src/crypto.js ./qjsc_macos -c -m -M events -M APPOTA -N jslib_appota -o bytecode/jsl...
YifuLiu/AliOS-Things
components/amp/jslib/gen_bytecode_macos.sh
Shell
apache-2.0
1,684
import * as ADC from 'ADC' class HW_ADC { constructor(options) { if (!options || !options.id) { throw new Error('options is invalid'); } this.options = { id: options.id }; this.success = options.success || function(){}; this.fail = options.f...
YifuLiu/AliOS-Things
components/amp/jslib/src/adc.js
JavaScript
apache-2.0
925
import * as APPOTA from 'APPOTA' import * as event from 'events' class UTILS_APPOTA extends event.EventEmitter { constructor(options){ super(); if (!options) { throw new Error('options invalid'); } this._init(options); } _init(options) { //console.log(...
YifuLiu/AliOS-Things
components/amp/jslib/src/appota.js
JavaScript
apache-2.0
878
import * as events from 'events' import * as AUDIOPLAYER from 'AUDIOPLAYER'; class AUDIO_PLAYER extends events.EventEmitter { constructor(){ super(); this._onState(); } play(source, callback) { if (!source || !callback) { throw new Error('invalid params'); } ...
YifuLiu/AliOS-Things
components/amp/jslib/src/audioplayer.js
JavaScript
apache-2.0
1,650
import * as events from 'events' import * as AUDIORECORDER from 'AUDIORECORDER'; class AUDIO_RECORDER extends events.EventEmitter { constructor(){ super(); } record(samplerate, channels, sbits, frames, sink) { if (!sink) { throw new Error('invalid params'); } re...
YifuLiu/AliOS-Things
components/amp/jslib/src/audiorecorder.js
JavaScript
apache-2.0
779
import * as BT_HOST from 'BT_HOST' import * as events from 'events' class bt_host extends events.EventEmitter{ constructor(options) { super(); if (!options) { throw new Error('options is invalid'); } if (this.inited == true) { throw new Error('bt_host already inited'); } ...
YifuLiu/AliOS-Things
components/amp/jslib/src/bt_host.js
JavaScript
apache-2.0
3,618
import * as CRYPTO from 'CRYPTO' export function encrypt(param) { let result = CRYPTO.encrypt( {'crypt_mode': "aes_cbc"}, param ); if (result != '') { console.log('encrypt success:'+result); } else { console.log('encrypt failed'); } return result; } export function decrypt(...
YifuLiu/AliOS-Things
components/amp/jslib/src/crypto.js
JavaScript
apache-2.0
556
import * as DAC from 'DAC' class HW_DAC { constructor(options) { if (!options || !options.id) { throw new Error('options is invalid'); } this.options = { id: options.id }; this.success = options.success || function(){}; this.fail = options.fa...
YifuLiu/AliOS-Things
components/amp/jslib/src/dac.js
JavaScript
apache-2.0
1,115
import * as kv from 'kv'; export function setDeviceInfo(pk, ps) { if (!pk || !ps) { throw new Error('params is invalid'); } var productkey_key = '_amp_internal_productkey'; var productsecret_key = '_amp_internal_productsecret'; kv.setStorageSync(productkey_key, pk); kv.setStorageSync(p...
YifuLiu/AliOS-Things
components/amp/jslib/src/device.js
JavaScript
apache-2.0
614
'use strict'; var spliceOne; function EventEmitter() { EventEmitter.init.call(this); } EventEmitter.EventEmitter = EventEmitter; EventEmitter.usingDomains = false; EventEmitter.prototype._events = undefined; EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; var default...
YifuLiu/AliOS-Things
components/amp/jslib/src/events.js
JavaScript
apache-2.0
11,136
import * as FS from 'FS' export function writeSync(path, data, options) { if (!path || !data) { throw new Error('params is invalid'); } options = options || {flag: 'w'}; FS.write(path, data, options); } export function readSync(path) { if(!path) { throw new Error("invalid params");...
YifuLiu/AliOS-Things
components/amp/jslib/src/fs.js
JavaScript
apache-2.0
741
import * as GPIO from 'GPIO' class HW_GPIO { constructor(options) { if (!options || !options.id) { throw new Error("options is invalid"); } this.options = { id: options.id }; this.success = options.success || function(){}; this.fail = options...
YifuLiu/AliOS-Things
components/amp/jslib/src/gpio.js
JavaScript
apache-2.0
1,454
import * as I2C from 'I2C' function byteArrayToArrayBuffer(byteArray) { return new Uint8Array(byteArray).buffer } class HW_I2C { constructor(options) { if (!options || !options.id) { throw new Error("options is invalid"); } this.options = { id: options.id ...
YifuLiu/AliOS-Things
components/amp/jslib/src/i2c.js
JavaScript
apache-2.0
1,781
import * as event from 'events' import * as AIOT_DEVICE from 'AIOT_DEVICE' import * as AIOT_GATEWAY from 'AIOT_GATEWAY' class IotDeviceClient extends event.EventEmitter { constructor(options){ super(); if(!options || !options.productKey || !options.deviceName || !options.deviceSecret){ ...
YifuLiu/AliOS-Things
components/amp/jslib/src/iot.js
JavaScript
apache-2.0
7,502
import * as std from 'std' import * as NETWORK from 'NETWORK'; var WIFI_TYPE = 0; var CELLULAR_TYPE = 1; var ETHNET_TYPE = 2; class ADVANCED_LOCATION { constructor() { this.devType = NETWORK.getType(); if (this.devType === WIFI_TYPE) { std.eval('import * as NETMGR from \'NETMGR\'; globalThis.NETMGR = ...
YifuLiu/AliOS-Things
components/amp/jslib/src/location.js
JavaScript
apache-2.0
1,688
import * as event from 'events' import * as MQTT from 'MQTT' class MQTTClient extends event.EventEmitter { constructor(options) { super(); if (!options || !options.host) { throw new Error('options is invalid'); } this.options = { host: options.host, ...
YifuLiu/AliOS-Things
components/amp/jslib/src/mqtt.js
JavaScript
apache-2.0
4,249
import * as NETMGR from 'NETMGR' import * as events from 'events' class netMgr extends events.EventEmitter { constructor(options) { super(); if (!options || !options.name) { throw new Error('device info error'); } this.options = { name: options.name ...
YifuLiu/AliOS-Things
components/amp/jslib/src/netmgr.js
JavaScript
apache-2.0
3,424
'use strict'; import * as std from 'std' import * as events from 'events' import * as NETWORK from 'NETWORK' var devType = 0; class netWork extends events.EventEmitter { constructor(options) { super(); if (!options || !options.devType) { devType = this.getType(); } else...
YifuLiu/AliOS-Things
components/amp/jslib/src/network.js
JavaScript
apache-2.0
6,904
import * as ONEWIRE from 'ONEWIRE' class HW_ONEWIRE { constructor(options) { if (!options || !options.id) { throw new Error("options is invalid"); } this.options = { id: options.id }; this.success = options.success || function(){}; this.fail ...
YifuLiu/AliOS-Things
components/amp/jslib/src/onewire.js
JavaScript
apache-2.0
1,486
import * as PWM from 'PWM' class HW_PWM { constructor(options) { if (!options || !options.id) { throw new Error("options is invalid"); } console.log('pwm: pwm constructor start ' + options.id) this.options = { id: options.id }; this.success =...
YifuLiu/AliOS-Things
components/amp/jslib/src/pwm.js
JavaScript
apache-2.0
1,240
/* * QuickJS Read Eval Print Loop * * Copyright (c) 2017-2020 Fabrice Bellard * Copyright (c) 2017-2020 Charlie Gordon * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restri...
YifuLiu/AliOS-Things
components/amp/jslib/src/repl.js
JavaScript
apache-2.0
50,081
import * as RTC from 'RTC' export function start() { RTC.open(); } export function setTime(time) { if (!time) { throw new Error('params is invalid'); } if (!(time instanceof Date)) { throw new Error('params is invalid'); } var date = { year: time.getYear(), mo...
YifuLiu/AliOS-Things
components/amp/jslib/src/rtc.js
JavaScript
apache-2.0
790