KIOSK

GUIDE
top

B2BSerialPrint API

To use Samsung B2B API, 

<script type="text/javascript" src="$B2BAPIS/b2bapis/b2bapis.js"></script>

Should be loaded in index.html

'B2BSerialPrint::SerialPrintManagerObject' interface

Public Attributes

readonly attribute SerialPrintManager serialprint

Details in English

Namespace for SerialPrint API.

Returns

SerialPrint API

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

Attributes

B2bApi implements SerialPrintManagerObject
The interface defines what is instantiated by the B2bApi object of Tizen Samsung TV Product API. There will be a b2bapis.serialprint object that allows access to the functionality of the SerialPrint API.

Enumerations

PrinterStopBits
Enumerator

Details in English

Available Serial port stop bits on KIOSK Set

Enumvalues

Bits
   1 bits of stop
Bits
   1.5 bits of stop
Bits
   2 bits of stop

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

PrintPortNum
Enumerator
PRINTERPORT0zero print port number
PRINTERPORT1first print port number

Details in English

Available Serial port on KIOSK Set

Enumvalues

PRINTERPORT0
   zero print port number
PRINTERPORT1
   first print port number

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

PrinterParity
Enumerator
NONE
ODD
EVEN

Details in English

Available Serial port parity of KIOSK Set

Enumvalues

Parity
   option of None Parity
Parity
   option of Odd Parity
Parity
   option of Even Parity

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

PrinterDataBits
Enumerator
BITS55 bytes
BITS6
BITS7
BITS8

Details in English

Available Serial port data bits on KIOSK Set

Enumvalues

BITS5
   5 bytes
BITS5
   6 bytes
BITS5
   7 bytes
BITS5
   8 bytes

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

'B2BSerialPrint::SerialPrintManager' interface

Public Methods

DOMString getVersion ( )
This interface provides methods to get serialprint module version.
Boolean close ( PrintPortNum printport )
Interface to close serial port of print device.

Public Methods

DOMString getVersion()

   This interface provides methods to get serialprint module version.

Details in English

get serialprint module version.

Returns

DOMString serialprint plug-in's version.

Exceptions

B2bAPIException
   with error type SecurityError, if the application does not have the privilege to call this method.
B2bAPIException
   with error type UnknownError in any other error case.
var Version = null;
try {
Version = b2bapis.serialprint.getVersion();
} catch (e) {
console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
if(null !== Version){
console.log("[getVersion] call syncFunction type: " + Version);
}

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Product

B2B_LFD

Version

1.0

Since

4.0

SDK Support

N

Boolean open(PrintPortNum printport, serialPrinterOption option, B2BPrintSerialListener onlistener)

   Interface to open serial port of print device.

Details in English

This interface provides methods toopen serial port of print device

Parameters

printport
   number of print device serial port
option
   options to open serial port
onlistener
   Cllback function to listen the print serial data.

Returns

Boolean true is returned when print serial port open successfully or false is retured when Unable to open print serial port.

Exceptions

B2bAPIException
   with error type SecurityError, if the application does not have the privilege to call this method.
B2bAPIException
   with error type TypeMismatchError, Invalid parameter type passed for input parameter.
var option = NULL;
option = {
baudRate : 9600,
parity : "NONE",
dataBits : "BITS8",
stopBits : "1"
}
console.log("[open] function call");
var result = false;
var printport = "PRINTERPORT0";
function onlistener(printSerialData)
{
console.log("Print serial data is " + printSerialData.data +", Print serial Port is === " + printSerialData.result);
}
try
{
result = b2bapis.serialprint.open(printport,option,onlistener);
if(result == true)
{
console.log("Success to open print serial port");
}
else
{
console.log("Fail to open print serial port" + result);
}
}
catch(e)
{
console.log("[open] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

Boolean close(PrintPortNum printport)

   Interface to close serial port of print device.

Details in English

This interface provides methods toclose serial port of print device

Parameters

printport
   number of print device serial port

Returns

Boolean true is returned when print serial port close successfully or false is retured when Unable to close print serial port.

Exceptions

B2bAPIException
   with error type SecurityError, if the application does not have the privilege to call this method.
B2bAPIException
   with error type TypeMismatchError, Invalid parameter type passed for input parameter.
var result = false;
var printport = "PRINTERPORT0";
try
{
result = b2bapis.serialprint.close(printport);
if(result == false)
{
console.log("Fail to close print serial port");
}
}
catch(e)
{
console.log("[close] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

long writeData(PrintPortNum printerport, DOMString data, long size)

   Interface to write Data of print device.

Details in English

This interface provides methods to write Data of print device

Parameters

printerport
   number of print device serial port
data
   data to write
size
   size of data

Returns

Long the size of the written data and if data has not been written, 0 is returned.

Exceptions

B2bAPIException
   with error type SecurityError, if the application does not have the privilege to call this method.
B2bAPIException
   with error type TypeMismatchError, Invalid parameter type passed for input parameter.
var result = false;
var printerport = "PRINTERPORT0";
var data = "0123456789ABCDEF3F0F2A";
try
{
result = b2bapis.serialprint.writeData(printerport, data, data.length);
console.log("[writeData_0] writeData size is " + result);
}
catch(e)
{
console.log("[writeData] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Version

1.0

Since

4.0

Product

B2B_LFD

SDK Support

N

'B2BSerialPrint::B2BPrintSerialListener' interface

Public Methods

void onlistener ( resultValue data )
Interface to set callback for reading print Serial data.

Public Methods

void onlistener( resultValue data)

   Interface to set callback for reading print Serial data.

Details in English

This method is callback parameter.

Parameters

data
   Provide print serial message whenever data is updated.

Returns

N/A

Exceptions

B2bAPIException
   with error type SecurityError, if the application does not have the privilege to call this method.
B2bAPIException
   with error type UnknownError in any other error case.
var option = NULL;
var printerPort = "PRINTPORTNUM0";
option = {
baudRate : 9600,
parity : "NONE",
dataBits : "BITS8",
stopBits : "1"
}
function onlistener(printSerialData)
{
console.log("Print serial data is " + printSerialData.data + printSerialData.result);
}
try
{
result = b2bapis.serialprint.open(printerPort,option,onlistener);
if(result == false)
{
console.log("Fail to open print serial port");
}
}
catch(e)
{
console.log("[open] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}

Version

1.0

Since

4.0

Privilege Level

Public

Privilege

http://developer.samsung.com/privilege/serialport

Product

B2B_LFD

SDK Support

N

위로가기