<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style>
body {
font-family: 'Calibri';
}
a {
text-decoration: none;
}
div {
display: inline-block;
float: left;
background-color: #019AC4;
color: #FFFFFF;
width: 250px;
height: 34px;
margin: 10px;
padding: 10px;
}
</style>
<script src="totvstec.js"></script>
<script>
onload = function () { loadEngine(); }
function loadEngine() {
// Conecta WebSocket Server
totvstec.connectWS( function(){
// Carrega mensageria exclusiva da pagina
dialog.advplToJs.connect(function (codeType, codeContent, objectName) {
//if (codeType == "") {
//}
});
// Envia sinal informando termino da carga
dialog.jsToAdvpl("page_started", "Pagina inicializada");
});
}
// Funcoes de CallBack Advpl -> JS
function getPictureSuccess(image) {
totvstec.createNotification( 1, "getPicture", image );
}
function barCodeScannerSuccess(barCode) {
totvstec.createNotification( 1, "barCodeScanner", barCode );
}
function pairedDevicesSuccess(paired) {
alert(paired);
}
function getCurrentPositionSuccess(position) {
// Necessario retirar o sinal de Grau para que o MAPS reconheca a posicao
position = position.replace(/�?/g, "");
window.location.href = "http://maps.google.com/?q=" + position;
}
function readAccelerometerSuccess(sensorRead) {
alert(sensorRead);
}
function getDateaddCalendarSuccess(id) {
var today = new Date(alert("CalendarId:" + id);
}
var dd = today.getDate();
var mmsavedid = today.getMonth()+1; //January is 0!"0";
function findCalendarSuccess(retIds) {
var yyyy = today.getFullYear();
alert("Ids encontrados " return mm+'/'+dd+'/'+yyyy+ retIds);
}
obj = JSON.parse(retIds);
function runAdvplSuccess(retStr){
savedid = obj.ids[0];
alert(retStr);}
}
function testDeviceSuccessgetCalendarSuccess(lRetcalev) {
obj = alertJSON.parse(lRetcalev);
}
alert("titulo
- " + obj.title function getTempPathSuccess(tempPath){
+ "\n" +
alert(tempPath);
"descricao - " + }
obj.descr + "\n" +
function findContactSuccess(contact) {
"local alert(contact);
- " + obj.addr }
+ "\n" +
function dbGetSuccess(data){
var jsonStr = JSON.stringify(data);
"data ini - " + obj.startdate + "\n" +
alert('dbGetSuccess: ' + jsonStr.replace(/"/g, "'"));
}
"hora ini -
" + obj.starttime + "\n" +
function dbError(error){
alert("dbError: "data fim - " + error);
obj.enddate + }"\n" +
function dbSuccess(){
"hora fim //- Dummy
" + obj.endtime + "\n" }+
// Cria tabela
"dia todo - " + obj.allday);
function dbCreateTableSuccess(){
}
function getDate(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
return mm+'/'+dd+'/'+yyyy;
}
function runAdvplSuccess(retStr){
alert(retStr);
}
function testDeviceSuccess(lRet){
alert(lRet);
}
function getTempPathSuccess(tempPath){
alert(tempPath)
}
function dbGetSuccess(data){
var jsonStr = JSON.stringify(data);
alert('dbGetSuccess: ' + jsonStr.replace(/"/g, "'"));
}
function dbError(error){
alert("dbError: " + error);
}
function dbSuccess(){
// Dummy
}
// Cria tabela
function dbCreateTableSuccess(){
totvstec.dbExec( "insert into newTab values (1,'User 1')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (2,'User 2')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (3,'User 3')", dbSuccess, dbError );
alert("dbCreateTableSuccess: Tabela criada com sucesso");
}
function dbCreateTable(){
totvstec.dbExec("create table newTab (cod INTEGER, name TEXT)", dbCreateTableSuccess, dbError);
}
// Deleta tabela
function dbDropTableSuccess(){
alert("dbDropTable: Ok");
}
function dbDropTable(){
totvstec.dbExec("drop table newTab", dbDropTableSuccess, dbError);
}
function testCommitProcess(){
totvstec.dbBegin(dbSuccess, dbError);
totvstec.dbExec( "insert into newTab values (4,'User 4')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (5,'User 5')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (6,'User 6')", dbSuccess, dbError );
totvstec.dbCommit(dbSuccess, dbError);
alert("testCommitProcess: Ok");
}
function testRollbackProcess(){
totvstec.dbBegin(dbSuccess, dbError);
totvstec.dbExec( "insert into newTab values (14,'User 14')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (25,'User 25')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (36,'User 36')", dbSuccess, dbError );
totvstec.dbRollback(dbSuccess, dbError);
alert("dbCreateTableSuccesstestRollbackProcess: Tabela criada com sucessoOk");
} }
function dbCreateTable(){</script>
</head>
<body>
<font face=calibri color="#FFFFFF">
totvstec.dbExec("create table newTab (cod INTEGER, name TEXT)", dbCreateTableSuccess, dbError);
<p><img src="logo_totvs.png" align="left">
}<br>
<font size=14 face=calibri // Deleta tabelacolor="#039CBB"> Cloud Bridge - Custom</font>
function dbDropTableSuccess(){</p><br>
alert("dbDropTable: Ok");
}<div style="background-color: #DB4437; width: 90%; height: 12px;">
function dbDropTable(){
totvstec.dbExec("drop table newTab", dbDropTableSuccess, dbError);<font size="4">Acesso ao SQLite </font><br><br>
}</div>
function testCommitProcess<a onclick='dbCreateTable(){;'>
totvstec.dbBegin(dbSuccess, dbError);<div>
totvstec.dbExec( "insert into newTab values (4,'User 4')", dbSuccess, dbError );
totvstec.dbExec( "insert into newTab values (5,'User 5')", dbSuccess, dbError );<font size="5">Cria Tabela</font><br><br>
</div>
</a>
totvstec.dbExec( "insert into newTab values<a (6,'User 6')", dbSuccess, dbError );
onclick='dbDropTable();'>
<div>
totvstec.dbCommit(dbSuccess, dbError);
alert("testCommitProcess: Ok");<font size="5">Apaga Tabela</font><br><br>
}
</div>
function testRollbackProcess(){
</a>
<a onclick='totvstec.dbBegin(dbSuccessdbGet("select * from newTab", dbGetSuccess, dbError);'>
totvstec.dbExec( "insert into newTab values (4,'User 4')", dbSuccess, dbError );
<div>
<font size="5">Recupera dados</font><br><br>
totvstec.dbExec( "insert into newTab values (5,'User 5')", dbSuccess, dbError ); </div>
</a>
totvstec.dbExec( "insert into newTab values
(6,'User 6')", dbSuccess, dbError );
<a onclick='totvstec.dbGet("SELECT name FROM sqlite_master WHERE totvstec.dbRollback(dbSuccesstype=\"table\"", dbGetSuccess, dbError);'>
alert("testRollbackProcess: Ok");<div>
}
</script>
</head>
<body>
<font size="5">Lista Tabelas</font><br><br>
<font face=calibri color="#FFFFFF">
<p><img src="logo_totvs.png" align="left"></div>
</a> <br>
<font<a size=14 face=calibri color="#039CBB"> Cloud Bridge - Custom</font>
onclick='testRollbackProcess();'>
<div>
</p><br>
<div style="background-color: #DB4437; width: 90%; height: 12px;">
<font size="5">Proc.c/ Rollback</font><br><br>
<font size="4">Acesso ao SQLite </font><br><br>div>
</div>a>
<a onclick='dbCreateTabletestCommitProcess();'>
<div>
<font size="5">Cria Tabela<>Proc. c/ Commit</font><br><br>
</div>
</a>
<a<div onclick='dbDropTable();'>
<div>
style="background-color: #DB4437; width: 90%; height: 12px;">
<font size="5">Apaga Tabela</font><br><br>
</div>4">Acesso ao periferico</font><br><br>
</a>div>
<a onclick='totvstec.dbGet("select * from newTab", dbGetSuccess, dbErrorrunAdvpl("DtoS(CtoD(\"" +getDate()+ "\"))", runAdvplSuccess);'>
<div>
<font size="5">Recupera dados<>runAdvpl</font><br><br>
</div>
</a>
<a onclick='totvstec.dbGet("SELECT name FROM sqlite_master WHERE type=\"table\"", dbGetSuccess, dbErrorgetPicture(0,getPictureSuccess);'>
<div>
<font size="5">Lista>Captura Tabelas<imagem</font><br><br>
</div>
</a>
<a onclick='testRollbackProcess(totvstec.getPicture(200,getPictureSuccess);'>
<div>
<font size="5">Proc.c/ Rollback<>Captura imagem (Redimensionando)</font><br><br>
</div>
</a>
<a onclick='testCommitProcesstotvstec.barCodeScanner(barCodeScannerSuccess);'>
<div>
<font size="5">Proc. c/ Commit<>Código de barras</font><br><br>
</div>
</a>
<div<a style="background-color: #DB4437; width: 90%; height: 12px;">
onclick='totvstec.pairedDevices(pairedDevicesSuccess);'>
<div>
<font size="4">Acesso ao periferico</font><br><br>5">Pareados</font><br><br>
</div>
</div>a>
<a onclick='totvstec.runAdvpl("DtoS(CtoD(\"" +getDate()+ "\"))", runAdvplSuccessgetCurrentPosition(getCurrentPositionSuccess);'>
<div>
<font size="5">runAdvpl<>Geo Posição</font><br><br>
</div>
</a>
<a onclick='totvstec.getPictureunlockOrientation(getPictureSuccess);'>
<div>
<font size="5">Captura imagem<>Libera Orientação</font><br><br>
</div>
</a>
<a onclick='totvstec.barCodeScannerlockOrientation(barCodeScannerSuccess);'>
<div>
<font size="5">Código de barras<>Trava Orientação</font><br><br>
</div>
</a>
<a onclick='totvstec.pairedDevices(pairedDevicesSuccesscreateNotification( 1, "Titulo da Notificação", "Corpo da Notificação" );'>
<div>
<font size="5">Pareados<>Notificação</font><br><br>
</div>
</a>
<a onclick='totvstec.getCurrentPositionvibrate(getCurrentPositionSuccess400);'>
<div>
<font size="5">Geo Posição<"5">Vibrar</font><br><br>
</div>
</a>
<a onclick='totvstec.unlockOrientationgetTempPath(getTempPathSuccess);'>
<div>
<font size="5">Libera Orientação<>GetTempPath</font><br><br>
</div>
</a>
<a onclick='totvstec.lockOrientationreadAccelerometer(readAccelerometerSuccess);'>
<div>
<font size="5">Trava Orienta>Acelerção<ocirc;metro</font><br><br>
</div>
</a>
<a onclick='totvstec.createNotification( 1, "Titulo da Notificação", "Corpo da Notificação" );'> </a>
<a onclick='totvstec.addContact( "CST <div>
<font size="5">Notificação</font><br><br>
</div>
</a>
<a onclick='totvstec.vibrate(400TOTVS", "Centro de Serviços TOTVS", "TOTVS SA", "[email protected]", 2, "+55 11 4003-0015", 2, "Av. Braz Leme, 1631 - Jd. São Bento - São Paulo/SP", "Canal exclusivo para assuntos administrativos e financeiros. Atendimento: de segunda à sexta, das 8h00 às 12h00 e das 13h30 às 18h00." );'>
<div>
<font size="5">Vibrar<>AddContact</font><br><br>
</div>
</a>
<a onclick='totvstec.addCalendar("TOTVS", "Descrição TOTVS", "Endereço TOTVS", new Date().toJSON().slice(0,10),"08:00:00", new Date().toJSON().slice(0,10), "09:00:00", <a onclick='totvstec.getTempPath(getTempPathSuccess"False", addCalendarSuccess);'>
<div>
<font size="5">GetTempPath<>AddCalendar</font><br><br>
</div>
</a>
<a onclick='totvstec.readAccelerometer(readAccelerometerSuccess);'>
<div>
<font size="5">Acelerômetro</font><br><br>
<a onclick='totvstec.findCalendar(new Date().toJSON().slice(0,10),new Date( (new </div>
Date()).valueOf() + 1000*3600*24 ).toJSON().slice(0,10), findCalendarSuccess);'>
</a>
<div>
<a onclick='totvstec.addContact("CST TOTVS", "Centro de Serviços TOTVS", "TOTVS SA",<font "[email protected]", 2, "+55 11 4003-0015", 2, "Av. Braz Leme, 1631 - Jd. São Bento - São Paulo/SP", "Canal exclusivo para assuntos administrativos e financeiros. Atendimento: de segunda à sexta, das 8h00 às 12h00 e das 13h30 às 18h00."size="5">FindCalendar</font><br><br>
</div>
</a>
<a onclick='totvstec.viewCalendar(savedid);'>
<div>
<font size="5">AddContact<>ViewCalendar</font><br><br>
</div>
</a>
<a onclick='totvstec.findContactgetCalendar("totvs", findContactSuccesssavedid,getCalendarSuccess);'>
<div>
<font size="5">FindContact<>GetCalendar</font><br><br>
</div>
</a>
<a onclick='alert(totvstec.version);'>
<div>
<font size="5">Versão JS</font><br><br>
</div>
</a>
<div style="background-color: #DB4437; width: 90%; height: 12px;">
<font size="4">Testa os perifericos</font><br><br>
</div>
<a onclick='totvstec.testDevice(totvstec.BLUETOOTH_FEATURE, testDeviceSuccess)'>
<div>
<font size="5">Testa BlueTooth</font><br><br>
</div>
</a>
<a onclick='totvstec.testDevice(totvstec.NFC_FEATURE, testDeviceSuccess)'>
<div>
<font size="5">Testa NFC</font><br><br>
</div>
</a>
<a onclick='totvstec.testDevice(totvstec.WIFI_FEATURE, testDeviceSuccess)'>
<div>
<font size="5">Testa WIFI</font><br><br>
</div>
</a>
<a onclick='totvstec.testDevice(totvstec.LOCATION_FEATURE, testDeviceSuccess)'>
<div>
<font size="5">Testa GPS</font><br><br>
</div>
</a>
<a onclick='totvstec.testDevice(totvstec.CONNECTED_WIFI, testDeviceSuccess)'>
<div>
<font size="5">Conectado WIFI</font><br><br>
</div>
</a>
<a onclick='totvstec.testDevice(totvstec.CONNECTED_MOBILE, testDeviceSuccess)'>
<div>
<font size="5">Conectado 3G</font><br><br>
</div>
</a>
<div style="background-color: #DB4437; width: 90%; height: 12px;">
<font size="4">Abre as configurações</font><br><br>
</div>
<a onclick='totvstec.openSettings(totvstec.BLUETOOTH_FEATURE)'>
<div>
<font size="5">Abre BlueTooth</font><br><br>
</div>
</a>
<a onclick='totvstec.openSettings(totvstec.NFC_FEATURE)'>
<div>
<font size="5">Abre NFC</font><br><br>
</div>
</a>
<a onclick='totvstec.openSettings(totvstec.WIFI_FEATURE)'>
<div>
<font size="5">Abre WIFI</font><br><br>
</div>
</a>
<a onclick='totvstec.openSettings(totvstec.LOCATION_FEATURE)'>
<div>
<font size="5">Abre GPS</font><br><br>
</div>
</a>
</body>
</html>
|