#include "pch.h"
#include "framework.h"
#include "CommSDK.h"
#include "TcpComm.h"
|
DLLEXINT | BytesAvailable () |
| Get the bytes available.
|
|
DLLEXBOOL | Connected () |
| Is connected with the NET.
|
|
DLLEXVOID | Read (byte *buffer, int size) |
| Read data through the NET from printer.
|
|
DLLEXVOID | Write (byte *dataOut, int iDataSize) |
| Write data through the NET to printer.
|
|
DLLEXPBYTE | WriteAndWaitForResponse (byte *dataOut, int iDataSize, int responseStartTimeOut, int responseEndTimeOut, char *completetionToken) |
| Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
|
|
DLLEXVOID | Close () |
| Disconnect the printer.
|
|
DLLEXVOID | Open () |
| Open the printer through the NET.
|
|
DLLEXVOID | SendPrintFile (char *ipAddress, char *fileName) |
| Send file through the NET.
|
|
DLLEXVOID | SendPrintString (char *ipAddress, char *data, int iDataSize) |
| Send the string through the NET.
|
|
DLLEXVOID | TcpConnect (char *ipAddress, int port) |
| Connect to the selected NET device.
|
|
DLLEXVOID | GetComm (CObject *&ptrComm) |
| Get the pointer of communicating I/F.
|
|
◆ COMM_IDX
◆ BytesAvailable()
Get the bytes available.
- Returns
- Greater than 0 : The size of data bytes available
Equal to 0 : None
- Sample
pBuf = new byte[iBytes];
DLLEXINT BytesAvailable()
Get the bytes available.
Definition CommSDK.cpp:144
DLLEXVOID Read(byte *buffer, int size)
Read data through the NET from printer.
Definition CommSDK.cpp:272
◆ Close()
Disconnect the printer.
- Returns
- void
- Sample
DLLEXVOID Close()
Disconnect the printer.
Definition CommSDK.cpp:502
◆ Connected()
Is connected with the NET.
- Returns
- true or false
- Sample
DLLEXBOOL Connected()
Is connected with the NET.
Definition CommSDK.cpp:190
◆ GetComm()
Get the pointer of communicating I/F.
- Parameters
-
[in] | ptrComm | : a pointer to storage communicating I/F |
- Returns
- void
- Sample
CObject* commPtr = NULL;
DLLEXVOID GetComm(CObject *&ptrComm)
Get the pointer of communicating I/F.
Definition CommSDK.cpp:744
◆ Open()
Open the printer through the NET.
- Returns
- void
- Sample
DLLEXVOID Open()
Open the printer through the NET.
Definition CommSDK.cpp:542
◆ Read()
Read data through the NET from printer.
- Parameters
-
[in] | buffer | : the buffer for to storage data |
[in] | size | : buffer size |
- Returns
- void
- Sample
-
◆ SendPrintFile()
DLLEXVOID SendPrintFile |
( |
char * | ipAddress, |
|
|
char * | fileName ) |
Send file through the NET.
- Parameters
-
[in] | ipAddress | : IP address |
[in] | fileName | : file path |
- Returns
- void
- Sample
DLLEXVOID SendPrintFile(char *ipAddress, char *fileName)
Send file through the NET.
Definition CommSDK.cpp:603
◆ SendPrintString()
DLLEXVOID SendPrintString |
( |
char * | ipAddress, |
|
|
char * | data, |
|
|
int | iDataSize ) |
Send the string through the NET.
- Parameters
-
[in] | ipAddress | : IP address |
[in] | data | : the data to the printer |
[in] | iDataSize | : the size of data |
- Returns
- void
- Sample
SendPrintString((
char*)
"10.0.10.172", (
char*)
"FEED 100", strlen(
"FEED 100"));
DLLEXVOID SendPrintString(char *ipAddress, char *data, int iDataSize)
Send the string through the NET.
Definition CommSDK.cpp:648
◆ TcpConnect()
DLLEXVOID TcpConnect |
( |
char * | ipAddress, |
|
|
int | port ) |
Connect to the selected NET device.
- Parameters
-
[in] | ipAddress | : IP address |
[in] | port | : port number:9100 |
- Returns
- void
- Sample
DLLEXVOID TcpConnect(char *ipAddress, int port)
Connect to the selected NET device.
Definition CommSDK.cpp:691
◆ Write()
DLLEXVOID Write |
( |
byte * | dataOut, |
|
|
int | iDataSize ) |
Write data through the NET to printer.
- Parameters
-
[in] | dataOut | : the data write to printer |
[in] | iDataSize | : the size of data to write to printer |
- Returns
- void
- Sample
std::string content;
content += "FEED 100";
const char* pStr = content.c_str();
Write((
byte*)pStr, strlen(pStr));
DLLEXVOID Write(byte *dataOut, int iDataSize)
Write data through the NET to printer.
Definition CommSDK.cpp:355
◆ WriteAndWaitForResponse()
DLLEXPBYTE WriteAndWaitForResponse |
( |
byte * | dataOut, |
|
|
int | iDataSize, |
|
|
int | responseStartTimeOut, |
|
|
int | responseEndTimeOut, |
|
|
char * | completetionToken ) |
Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning.
- Parameters
-
[in] | dataOut | : the data write to printer |
[in] | iDataSize | : the size of data to write to printer |
[in] | responseStartTimeOut | : Timeout to wait for first data to be received. Time to first byte |
[in] | responseEndTimeOut | : Timeout of no new data received. Time after last byte |
[in] | completetionToken | String token denoting the end of the response expected. This can be empty string if simply want to wait for response after writing data to connection. |
- Returns
- byte* string received from connection. Data returned is any data received or up to completetionToken if token received
- Sample
std::string content;
content += "FEED 100\r\n";
content += "OUT \"12345678\"\r\n";
std::cout << std::endl;
std::cout << "Send to Printer:" << std::endl;
std::cout << content;
const char* pStr = content.c_str();
DLLEXPBYTE WriteAndWaitForResponse(byte *dataOut, int iDataSize, int responseStartTimeOut, int responseEndTimeOut, char *completetionToken)
Write byte data to output stream and return data received. Data returned is any data received or up t...
Definition CommSDK.cpp:448
◆ giComm
◆ gTcpComm
◆ gTcpConnection
TcpConnection gTcpConnection |
◆ theApp