Manual de Programação do posGoImplementação das Classes do SDK - versão 2.0
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
1. IntroduçãoO posGo é um terminal de vendas móvel completo, em um único dispositivo estão a CPU, telatouch, impressora térmica e “maquininha” de cartão. Tudo isto em um equipamento de designprático, leve, tela de toque colorida e capacitiva de 5,5 polegadas, com display de alta resolução emultitouch para ser segurado com uma mão.
Possui bateria interna que permite o funcionamento desligado da tomada e com conexão de redesem fio para poder ser levado em qualquer lugar.
Opera com sistema Android, permitindo a utilização de aplicativos de vendas compatíveis.
É perfeito para ser utilizado como terminal de vendas principal ou extensão de um terminal devendas fixo.
O posGo é ideal para negócios com pouco espaço ou que exigem atendimento do cliente commobilidade, acabando com as filas de caixa.
O cliente conta com recursos que inovam e ao mesmo tempo simplificam o atendimento:
Assinatura na tela;
Leitor 1D e 2D (QRCode);
GPS, 3G e Bluetooth;
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Leitor de cartão por tarja magnética e chip;
NFC.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
2. Especi�cações TécnicasPROCESSADOR
Núcleos 4 + 1 processador de alta segurança
Arquitetura da CPU ARMv7 Processor rev 5 (v71)
Placa msm8909
Chipset Qualcomm Technologies, Inc.
Velocidade de Clock 1094 MHz - 1094 MHz
Conjunto de instruções armeabi-v7a, armeabi
Versão do Kernel armv7I
Memória FLASH 8GB, RAM 1GB e suporte para cartãomicroSD
GRÁFICOS
Renderizador Gráfico Adreno (TM) 304
Fornecedor Qualcomm
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Versão OpenGL OpenGL ES 3.0
TELA
Tela sensível ao toque, tipo capacitivo, suporta e-assinatura
Resolução HD, 720 x 1280 pixels
Densidade de Software 320 dpi (xhdpi)
Taxa de Atualização 57 Hz
Resolução 5 MP
Flash Sim
Resoluções Suportadas Imagem:
2592x1944 2048x1536 1920x1080 1600x1200 1280x960 1280x768 1280x720 1024x768 800x600 800x480
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
720x480 640x480 352x288 320x240 176x144 160x120
Vídeo:
1920x1080 (Full HD) 1280x960 1280x720 (HD) 864x480 800x480 (WVGA) 720x480 640x480 (VGA) 480x360 352x288 320x240 176x144 160x120 480x640 (VGA) 240x320 144x176
DISPOSITIVO
Java VM ART 2.1.0
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Placa Lollipop MR1 (5.1.1)
Versão RIL Qualcomm RIL 1.0
SDK 22
PINPAD PINPAD integrado (Teclado virtual)
Impressora Impressora térmica direta
Bobina de Papel Diâmetro 40mm , largura 25mm
Leitor Magnético 1,2,3 tarjas bidirecionais
Comunicação 3G Netcom , WIFI e Bluetooth 4.1
Leitores de Cartão
PSAM: 2
SIM: 1
SD: 1
NFC 13.56MHz, support ISO14443
Não é possível emular o posGo no Android Studio, devido às dependênciasespecíficas do hardware.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
3. BibliotecasArquivo Descrição
nexgo-smartpos-sdk-vxxxx.aar Pacote AAR de interface da API
iso8583_V1.0.jar Dependência
spdh_V1.6.jar Dependência
Como obtenho o SDK do posGo?
Todo o conteúdo e material de apoio está disponível no site do posGo, é só fazer ocadastro para ter acesso à área de downloads do Portal.
4. Requisitos Básicos do SistemaAmbiente de Desenvolvimento: Android Studio 2.0 ou superior.
Sistema Operacional: Android 5.1.1.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5. Classe PrinterEssa classe é responsável pela impressão no posGo.
Obter o objeto da classe printer:
A tabela a seguir mostra os valores de retorno suportados pelo método da classe de impressora:
Nome da Constante Valor Descrição
Printer_Base_Error -1000 Erro
Printer_Print_Fail Printer_Print_Error -1 Falha na impressão
Printer_AddPrnStr_Fail Printer_Print_Error -2 Falha na configuração dobuffer
Printer_AddImg_Fail Printer_Print_Error -3 Falha na configuração daimagem
Printer_Busy Printer_Print_Error -4 A impressora está ocupada
Printer_PaperLack Printer_Print_Error -5 A impressora está sem papel
Printer printer = deviceEngine.getPrinter();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Nome da Constante Valor Descrição
Printer_Wrong_Package Printer_Print_Error -6 O pacote de impressão estáincorreto
Printer_Fault Printer_Print_Error -7 Impressora em falha
Printer_TooHot Printer_Print_Error -8 A impressora estásuperaquecida
Printer_UnFinished Printer_Print_Error -9 A impressão não está completa
Printer_NoFontLib Printer_Print_Error -10 A impressora não possui umafonte
Printer_OutOfMemory Printer_Print_Error -11 o pacote é muito grande
Printer_Other_Error Printer_Print_Error -999 Erro de exceção desconhecido
5.1. initPrinterInicializa a impressão.
5.1.1. Parâmetros:
Não tem parâmetros.
public int initPrinter();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.1.2. Retorno:
SdkResult.Success: sucesso.
5.2. getStatusObter o status da impressora.
5.2.1. Parâmetros:
Não tem parâmetros.
5.2.2. Retorno:
SdkResult.Success: Impresso com sucesso
SdkResult.Printer_UnFinished: A impressão não está completa
SdkResult.Printer_PaperLack: A impressora está sem papel
SdkResult.Printer_TooHot: A impressora está superaquecida
SdkResult.Printer_Fail: Falha na impressão
SdkResult.Fail: Erro desconhecido
public int getStatus();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.3. appendImageInsere uma imagem.
5.3.1. Parâmetros:
Parâmetro Descrição
bitmap arquivo de imagem
align Tipo enumerado de alinhamento
5.3.2. AlignEnum
Nome Enumerado Descrição
LEFT Alinhar à esquerda
RIGHT Alinhar à direita
CENTER Alinhar ao centro
5.3.3. Retorno:
SdkResult.Success: Imagem inserida com sucesso
SdkResult.Printer_AddImg_Fail: Falha ao inserir a imagem
public int appendImage(Bitmap bitmap, AlignEnum align);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.4. AppendPrnStrAdiciona uma String de texto.
5.4.1. Parâmetros:
Parâmetro Descrição
Text Dados da String a ser adicionada.
fontSize Font Size small: 16; normal: 20; large: 24; x-large:32
align Tipo enumerado de alinhamento.
isBoldFont Negrito, sendo true (sim) ou false (não).
5.4.2. AlignEnum
Nome Enumerado Descrição
LEFT Alinhar à esquerda
RIGHT Alinhar à direita
public int appendPrnStr (String text, int fontsize, AlignEnum align, Boolean isBoldFont);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Nome Enumerado Descrição
CENTER Alinhar ao centro
5.4.3. Retorno:
SdkResult.Success: Impresso com sucesso
SdkResult.Printer_Wrong_Package: Pacote para impressão com formato incorreto.
SdkResult.Printer_AddPrnStr_Fail: Buffer da String configurado incorretamente.
5.5. AppendPrnStrImprime um texto com duplo alinhamento, esquerdo e direito ao mesmo tempo.
5.5.1. Parâmetros:
Parâmetro Descrição
leftText Texto Alinhado a esquerda
rightText Texto Alinhado a direita
public int appendPrnStr (String leftText, String rightText, int fontsize, AlignEnum align, Boolean isBoldFont);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parâmetro Descrição
fontSize Font Size small: 16; normal: 20; large: 24; x-large:32
align Tipo enumerado de alinhamento.
isBoldFont Negrito, sendo true (sim) ou false (não).
5.5.2. AlignEnum
Nome Enumerado Descrição
LEFT Alinhar à esquerda
RIGHT Alinhar à direita
CENTER Alinhar ao centro
5.5.3. Retorno:
SdkResult.Success: Impresso com sucesso
SdkResult.Printer_Wrong_Package: Pacote para impressão com formato incorreto.
SdkResult.Printer_AddPrnStr_Fail: Buffer da String configurado incorretamente.
5.6. AppendBarcodeCreate PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
ppImprime um código de barras unidimensional.
5.6.1. Parâmetros:
Parâmetro Descrição
content Valor do código a ser gerado
format Formata o código de acordo com a tabela aseguir
width Largura do código a ser impresso, valor de 1 a384
height Altura do código a ser impresso, valor maior que0
align Alinhamento
5.6.2. BarcodeFormatEnum
Tipo de formatos
AZTEC
public int appendBarcode (String content, BarcodeFormatEnum format, int width, int height, AlignEnum align);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Tipo de formatos
CODABAR
CODE_39
CODE_93
CODE_128
DATA_MATRIX
EAN_8
EAN_13
ITF
MAXICODE
PDF_417
QR_CODE
RSS_14
RSS_EXPANDED
UPC_A
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Tipo de formatos
UPC_E
UPC_EAN_EXTENSION
5.6.3. AlignEnum
Nome Enumerado Descrição
LEFT Alinhar à esquerda
RIGHT Alinhar à direita
CENTER Alinhar ao centro
5.6.4. Retorno:
SdkResult.Success: Impresso com sucesso
SdkResult.Printer_AddImg_Fail: Falha ao inserir o código.
5.7. AppendQRCodeImprime um código bidimensional QR Code.
public int appendQRcode (String content, int width, int height, AlignEnum align);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.7.1. Parâmetros:
Parâmetro Descrição
content Valor do código a ser gerado
width Largura do código a ser impresso, valor de 1 a384
height Altura do código a ser impresso, valor maior que0
align Alinhamento
5.7.2. AlignEnum
Nome Enumerado Descrição
LEFT Alinhar à esquerda
RIGHT Alinhar à direita
CENTER Alinhar ao centro
5.7.3. Retorno:
SdkResult.Success: Impresso com sucesso
SdkResult.Printer_AddImg_Fail: Falha ao inserir o código.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.8. StartPrintInicia a impressão.
5.8.1. Parâmetros:
Parâmetro Descrição
rollPaperEnd Avance para o final do papel automaticamente,sendo true (sim) ou false (não)
listener A interface de retorno de chamada após aimpressão estar completa
5.8.2. Retorno:
SdkResult.Success: Impresso com sucesso, o listener pode ser acionado.
SdkResult.Printer_Busy: Impressora ocupada
SdkResult.Printer_Print_Fail: Não há dados para imprimir
SdkResult.Param_In_Invalid: Parâmetro incorreto
5.9. SetLetterSpacing
public int startPrint (boolean rollPaperEnd, OnPrintListener listener);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Defina o espaçamento entre as linhas ordenadas de impressão.
5.9.1. Parâmetros:
Parâmetro Descrição
value Espaçamento entre linhas em pixels. Valorpadrão é 4
5.9.2. Retorno:
Não há retorno.
5.10. setGrayConfigure a escala de cinza.
5.10.1. Parâmetros:
Parâmetro Descrição
public void setLetterSpacing (int value);
public void setGray (GrayLevelEnum level);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parâmetro Descrição
level Estabelece o valor cinza; Se o usuário nãodefiniu, o valor padrão é LEVEL_0. Quanto maiora escala de cinza, quanto mais escura a fonte de
impressão, mais lenta a velocidade deimpressão.
5.10.2. GrayLevelEnum
Nome Enumerado Descrição
LEVEL_0 Escala de cinza primária
LEVEL_1 Escala de cinza secundária
LEVEL_2 Escala de cinza terciária
5.10.3. Retorno:
Não há retorno.
5.11. setTypefaceConfigure o tipo de fonte.
public void setTypeface (Typeface typeface);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5.11.1. Parâmetros:
Parâmetro Descrição
typeface Tipo de fonte do tipo de SDK do Android; se ousuário não definiu, o padrão é
valueTypeface.DEFAULT
5.11.2. Retorno:
Não há retorno.
5.11.3. Exemplo de Implementação Java
final Printer printer = deviceEngine.getPrinter(); printer.setTypeface(Typeface.DEFAULT); printer.initPrinter(); printer.setTypeface(Typeface.DEFAULT); printer.setLetterSpacing(5); printer.appendPrnStr(getString(R.string.print_merchantname), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_merchantno), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_terminalno), getString(R.string.print_operator), 24, false); printer.appendPrnStr(getString(R.string.print_issurebank), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_shoudan), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_expiredate), 24,
1
2
3
4
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.cardnum), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_cardinfo), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_tradetype), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_batchno), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_voucher), getString(R.string.print_authorcode), 24, false); printer.appendPrnStr(getString(R.string.print_refrenceno), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_tradedate), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_amount), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.money), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_beizhu), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_originalvoucher), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_addinfo), 24, AlignEnum.LEFT, false); printer.appendBarcode(getString(R.string.print_barcode), 50, 0, 2, BarcodeFormatEnum.CODE_128, AlignEnum.CENTER); printer.appendQRcode(getString(R.string.print_qrcode), 200, AlignEnum.CENTER); printer.appendPrnStr("---------------------------", 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_cardhold), 24, AlignEnum.LEFT, false); printer.appendPrnStr("\n", 24, AlignEnum.LEFT, false);
5
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
1 Criando objeto "printer" da classe Printer
2 Iniciando o objeto "printer" com o método initPrinter()
3 Definindo o espaçamento entre linhas com o método setLetterSpacing
4 Adicionando texto com o appendPrnStr
printer.appendPrnStr("\n", 24, AlignEnum.LEFT, false); printer.appendPrnStr("\n", 24, AlignEnum.LEFT, false); printer.appendPrnStr("---------------------------", 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_cardhold_ensure), 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_cardhold_ensure), 24, AlignEnum.LEFT, false); printer.appendPrnStr("---------------------------", 24, AlignEnum.LEFT, false); printer.appendPrnStr(getString(R.string.print_merchant_dan), 24, AlignEnum.RIGHT, false); printer.startPrint(false, new OnPrintListener() { @Override public void onPrintResult(final int retCode) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, retCode + "", Toast.LENGTH_SHORT).show(); } }); } });
6
7
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
5 Adicionando o QR Code com o appendQRcode
6 Enviando o objeto "printer" com o conteúdo para impressão utilizando o método startPrint
7 Considerando que essa implementação está sendo realizada em MainActivity
6. Camera Sweep ClassA classe Camera scan code é responsável pelo gerenciamento da câmera do posGo; deve serinicializado antes de usar.
Obtendo o objeto da camera scan class:
A tabela a seguir mostra os valores de retorno suportados pelo método:
Nome da Constante Valor da Constante Descrição
Scanner_Base_Error -2000
Scanner_Customer_Exit Scanner_Base_Error - 1 Saída ativa do usuário
Scanner scanner = deviceEngine getScanner();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Nome da Constante Valor da Constante Descrição
Scanner_Other_Error Scanner_Base_Error - 2 Falha na digitalização docódigo
6.1. initScannerInicialize a configuração de digitalização.
6.1.1. Parâmetros:
Parâmetro Descrição
cfgEntity Iniciliza a configuração
listener Callback interface (Retorno)
6.1.2. ScannerCfgEntity
Atributos Descrição
boolean isUsedFrontCcd Se usar a câmera frontal, se apenas câmeratraseira, abra a câmera traseira por padrão
Public int initScanner (ScannerCfgEntity cfgEntity, OnScannerListener listener);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Atributos Descrição
boolean isBulkMode Se o modo de scan for contínuo, abra o scan apóso retorno com sucesso não sair da interface
int interval Intervalo de código de verificação contínuo, emmilissegundos; padrão 1000
boolean isAutoFocus Se é o foco automático
6.1.3. Retorno:
SdkResult.Success: Digitalizado com sucesso
SdkResult.Param_In_Invalid: Parâmetro incorreto.
SdkResult.Fail: Falha.
6.2. startScanInicializa o código de digitalização.
6.2.1. Parâmetros:
Public int startScan (int timeout, OnScannerListener listener);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parâmetro Descrição
timeout Tempo limite do código de verificação emsegundos; valor recomendado 60
listener Callback interface (Retorno)
6.2.2. Retorno:
SdkResult.Success: Digitalizado com sucesso
SdkResult.Param_In_Invalid: Parâmetro incorreto.
SdkResult.Fail: Falha.
6.3. stopScanParar a digitalização.
6.3.1. Parâmetros:
Não há.
6.3.2. Retorno:
Não há.
Public void stopScan();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
6.3.3. Exemplo de Implementação Java
final Scanner scanner = deviceEngine.getScanner(); ScannerCfgEntity cfgEntity = new ScannerCfgEntity(); cfgEntity.setAutoFocus(false); cfgEntity.setUsedFrontCcd(false); scanner.initScanner(cfgEntity, new OnScannerListener() { @Override public void onInitResult(int retCode) { if (retCode == SdkResult.Success) { int result = scanner.startScan(60, new OnScannerListener() { @Override public void onInitResult(int retCode) { } @Override public void onScannerResult(int retCode, final String data) { switch (retCode) { case SdkResult.Success: runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, getString(R.string.scanner_content) + " " + data, Toast.LENGTH_LONG).show(); } }); break; case SdkResult.TimeOut: runOnUiThread(new Runnable() { @Override public void run() {
1
2
3
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Toast.makeText(MainActivity.this, getString(R.string.scanner_timeout), Toast.LENGTH_SHORT).show(); } }); break; case SdkResult.Scanner_Customer_Exit: runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, getString(R.string.scanner_customer_exit), Toast.LENGTH_SHORT).show(); } }); break; default: runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, getString(R.string.scanner_fail), Toast.LENGTH_SHORT).show(); } }); break; } } }); if (result != SdkResult.Success) { Toast.makeText(MainActivity.this, getString(R.string.scanner_start_error), Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(MainActivity.this,
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
1 Criando objeto "scanner" da classe Scanner
2 Iniciando a configuração do objeto "scanner" com o método initScanner
3 Iniciando a digitalização com o método initScanner, já passando o valor de 60 segundos
7. installAppInstalação silenciosa do aplicativo especificado.
7.1. Parâmetros:
getString(R.string.scanner_init_error), Toast.LENGTH_SHORT).show(); } } @Override public void onScannerResult(int retCode, String data) { } });
public int installApp (Context context, String appFilePath, OnAppOperatListener listener);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parâmetro Descrição
context Contexto.
appFilePath Caminho absoluto para o apk.
listener Após a instalação da interface de retorno dechamada.
7.2. Retorno:
0 - execução bem-sucedida da interface de retorno de chamada do callback.
-1 - Falha.
7.3. Exemplo de implementação Java
private void backgroundInstall() { //coloque o xxx.apk no diretório raiz Toast.makeText(this, "colocar test.apk no diretório raiz, em seguida, será instalado", Toast.LENGTH_SHORT).show(); String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.apk"; Log.d(TAG, "backgroundInstall path: ===" + path); deviceEngine.installApp(this, path, new OnAppOperatListener() { @Override public void onOperatResult(final int i) { runOnUiThread(new Runnable() { @Override
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
8. uninstallAppDesinstalação silenciosa do aplicativo especificado.
8.1. Parâmetros:
Parâmetro Descrição
context Contexto.
packageName Nome do pacote.
public void run() { Toast.makeText(MainActivity.this, " result===" + i, Toast.LENGTH_SHORT).show(); } }); } }); }
public int uninstallApp (Context context, String packageName , OnAppOperatListener listener);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Parâmetro Descrição
listener Callback (retorno) da desinstalação.
8.2. Retorno:
SdkResult.Success) - execução bem-sucedida da interface de retorno de chamada do callback.
SdkResult.Fail- Falha.
9. getDeviceInfoobter informações do dispositivo.
9.1. DeviceInfo
Atributos Descrição
String sn Número serial do terminal
String ksn Customizar número serial do terminal
public DeviceInfo getDeviceInfo();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Atributos Descrição
String model Modelo do terminal
String osVer Versão do sistema operacional Android
String sdkVer Versão do SDK
String firmWareVer Versão do firmware
String kernelVer Versão do linux
String vendor fabricante
9.2. Retorno:
Em caso de sucesso retorna DeviceInfo, senão retorna null.
10. BuzzerA classe é responsável por gerenciar os sinais sonoros do posGo.
Obtendo os objetos da classe Buzzer:
Beeper beep = deviceEngine.getBeeper();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
10.1. beepDefina a duração do buzzer (sinal sonoro) com o tempo especificado.
A classe é responsável por gerenciar os sinais sonoros do posGo.
10.1.1. Parâmetros:
Parâmetro Descrição
timeout Tempo limite em milissegundos. Zero páraimediatamente
10.1.2. Retorno:
Não há.
10.1.3. Exemplo de Implementação Java
public void beep (int timeout);
final Beeper beeper = deviceEngine.getBeeper(); View dv = getLayoutInflater().inflate(R.layout.dialog_items_layout, null); ListView lv = (ListView) dv.findViewById(R.id.listView); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position,
1
2
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
long id) { switch (position) { case 0: Observable.just(null) .observeOn(Schedulers.io()) .subscribe(new Action1<Object>() { @Override public void call(Object o) { beeper.beep(100); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }); break; case 1: Observable.just(null) .observeOn(Schedulers.io()) .subscribe(new Action1<Object>() { @Override public void call(Object o) { beeper.beep(500); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }); break;
3
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
case 2: Observable.interval(70, TimeUnit.MILLISECONDS) .observeOn(Schedulers.io()) .takeUntil(new Func1<Long, Boolean>() { @Override public Boolean call(Long aLong) { return aLong == 1; } }) .subscribe(new Action1<Object>() { @Override public void call(Object o) { beeper.beep(50); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }); break; case 3: Observable.interval(600, TimeUnit.MILLISECONDS) .observeOn(Schedulers.io()) .takeUntil(new Func1<Long, Boolean>() { @Override public Boolean call(Long aLong) { return aLong == 3; } }) .subscribe(new Action1<Object>() { @Override
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
public void call(Object o) { beeper.beep(100); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }); break; case 4: Observable.interval(400, TimeUnit.MILLISECONDS) .observeOn(Schedulers.io()) .takeUntil(new Func1<Long, Boolean>() { @Override public Boolean call(Long aLong) { return aLong == 2; } }) .subscribe(new Action1<Object>() { @Override public void call(Object o) { beeper.beep(200); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }); break; }
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
1 Criando objeto "beeper" da classe Beeper
2 Utilizando um ListView para mostrar os valores
3 Utilizando um laço do tipo switch/case para exemplificar variados tipos de sinais sonoros.
11. Informações de Retorno (Callbackinformation)Métodos para obter informações de Callback.
11.1. OnPrintListenerResponsável pelo gerenciamento da interface de retorno de chamada da classe da impressora.
11.1.1. onPrintResult
} }); ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.beeper_items)); lv.setAdapter(stringArrayAdapter); new AlertDialog.Builder(this).setView(dv).create().show();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Depois de executar o método startPrint, retorno de chamada para imprimir os resultados.
11.1.1.1. Parâmetros:
Parâmetro Descrição
retCode Retorna resultados da impressão:
SdkResult.Success: successo
SdkResult.Printer_Print_Fail: falha na impressão
SdkResult.Printer_PaperLack: sem papel
SdkResult.Printer_UnFinished: impressãoinacabada
SdkResult.Printer_TooHot: impressora estásuperaquecendo
11.1.1.2. Retorno:
Não há.
public void onPrintResult (int retCode);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
12. OnScanner ListenerResponsável por gerenciar o callback dos resultados do código de verificação da câmera.
12.1. onInitResultInicialize o retorno de chamada da configuração da câmera.
12.1.1. Parâmetros:
Parâmetro Descrição
retCode Retorna resultados da impressão:
SdkResult.Success: successo
SdkResult.Fail: falha
12.1.2. Retorno:
Não há.
12.2. onScannerResult
public void onInitResult (int retCode);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Retorno dos resultados do scan code.
12.2.1. Parâmetros:
Parâmetro Descrição
retCode Retorna resultados da impressão:
SdkResult.Success: Successo
SdkResult.Fail: Falha
SdkResult.Param_In_Invalid: Erro de parâmetro
SdkResult.TimeOut: Timeout do scan code
SdkResult.Scanner_Customer_Exit: retiradavoluntária do usuário
12.2.2. Retorno:
Não há.
public void onScannerResult (int retCode, String data);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
13. OnAppOperatListenerResponsável pelo gerenciamento do callback (retorno) do resultado da instalação e desinstalaçãodo apk.
13.1. onOperatResultExecutando o installApp, após o método uninstallApp ser executado, o retorno de chamadaimprime os resultados.
13.1.1. Parâmetros:
Parâmetro Descrição
retCode Retorna resultados da impressão:
SdkResult.Success: successo
SdkResult.Fail: falha
13.1.2. Retorno:
Não há.
public void onOperatResult (int result);
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
14. Classe LEDA classe LED é responsável por gerenciar as luzes de led do posGo.
Obter o objeto da classe LED:
14.1. SetLedConfigure o led do PosGo em um dos quatro estados: vermelho, verde, amarelo e azul.
14.1.1. Parâmetros:
Parâmetro Descrição
light Tipo enumerado (LightModeEnum) do LEDvermelho, verde, amarelo e azul
isOn True: on, false: off
14.1.2. LightModeEnum
LEDDriver ledDriver = deviceEngine.getLEDDriver();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Nome Enumerado Descrição
RED Led Vermelho
GREEN Led Verde
YELLOW Led Amarelo
BLUE Led Azul
14.1.3. Retorno:
Não tem valor de retorno.
14.1.4. Exemplo de Implementação Java
final LEDDriver ledDriver = deviceEngine.getLEDDriver(); View dv = getLayoutInflater().inflate(R.layout.dialog_items_layout, null); ListView lv = (ListView) dv.findViewById(R.id.listView); final HashMap<Integer, LightModeEnum> hashMap = new HashMap<>(); hashMap.put(0, LightModeEnum.BLUE); hashMap.put(1, LightModeEnum.YELLOW); hashMap.put(2, LightModeEnum.RED); hashMap.put(3, LightModeEnum.GREEN); final boolean[] state = new boolean[hashMap.size()]; lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { state[position] = !state[position]; ledDriver.setLed(hashMap.get(position), state[position]);
1
2
3
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
1 Criando objeto "ledDriver" da classe LEDDriver
2 Utilizando um ListView para mostrar os valores
3 Configurando o estado do led pelo método setLed
} }); ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.led_items)); lv.setAdapter(stringArrayAdapter); new AlertDialog.Builder(this).setView(dv).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { for (int i = 0; i < hashMap.size(); i++) { ledDriver.setLed(hashMap.get(i), false); } } }).create().show();
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
15. Log de Versões do ManualVersão Descrição
1.0 Versão inicial com a classe Printer
2.0 Inserido as classes LED, Buzzer, Scanner(Câmera) e os métodos installApp, uninstallApp,
getDeviceInfo.
16. SuporteCentral de Atendimento ao Desenvolvedor
https://centraldeatendimento.bematech.com.br/hc/pt-br
Atendimento ao desenvolvedor - 0800-6447277
Portal de Desenvolvedores Bematech Partners
Manual Adaptado por Júlio César Bruno - Bematech Hardware Ltda.© - 2018/2019
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Last updated 2019-01-21 17:03:57 -0200
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD