UniPRT SDK v2.0-so (C++)
 
Loading...
Searching...
No Matches
Discovery.cpp File Reference
#include "Discovery.h"
#include "NetworkDiscover.h"
#include <vector>
#include <string>
#include <iostream>
#include <thread>
#include <mutex>
#include <sstream>
#include <atomic>
#include <chrono>
#include <cstdlib>
Include dependency graph for Discovery.cpp:

Macros

#define MAX_THREADS   64
 

Functions

std::vector< std::string > * GetPrinterList (Brand brand=Brand::ALL, int responseTimeoutMs=2000)
 Search a printer by network.
 
void FreePrinterList (std::vector< std::string > *pList)
 Release string resource.
 
std::vector< std::string > * GetPrinterList_IPv6 (std::string PREFIX, std::string INTERFACE_NAME, int responseTimeoutMs=2000)
 Search a printer by IPv6 network.
 
void FreePrinterList_IPv6 (std::vector< std::string > *pList)
 Release string resource.
 

Variables

std::mutex g_listMutex
 

Macro Definition Documentation

◆ MAX_THREADS

#define MAX_THREADS   64

Function Documentation

◆ FreePrinterList()

void FreePrinterList ( std::vector< std::string > * pList)

Release string resource.

Parameters
[in]pList: a string list resource
Returns
void
Sample
FreePrinterList(pPrinterList);
void FreePrinterList(std::vector< std::string > *pList)
Release string resource.
Definition Discovery.cpp:107

◆ FreePrinterList_IPv6()

void FreePrinterList_IPv6 ( std::vector< std::string > * pList)

Release string resource.

Parameters
[in]pList: a string list resource
Returns
void
Sample
void FreePrinterList_IPv6(std::vector< std::string > *pList)
Release string resource.
Definition Discovery.cpp:243

◆ GetPrinterList()

std::vector< std::string > * GetPrinterList ( Brand brand = Brand::ALL,
int responseTimeoutMs = 2000 )

Search a printer by network.

Parameters
[in]brand: set a brand of printer, e.g. Brand::ALL, Brand::TSC or Brand::PTX
[in]responseTimeoutMs: set the timeout for printer response
Returns
std::vector<std::string>*
Sample
std::vector<std::string>* pPrinterList = GetPrinterList(Brand::ALL, 3000);
std::vector< std::string > * GetPrinterList(Brand brand=Brand::ALL, int responseTimeoutMs=2000)
Search a printer by network.
Definition Discovery.cpp:64

◆ GetPrinterList_IPv6()

std::vector< std::string > * GetPrinterList_IPv6 ( std::string PREFIX,
std::string INTERFACE_NAME,
int responseTimeoutMs = 2000 )

Search a printer by IPv6 network.

Parameters
[in]PREFIX: IPv6 prefix, uses the ping method to search for all possible combinations of the last 16 bits of the IP address
[in]INTERFACE_NAME: platform interface ID
[in]responseTimeoutMs: set the timeout for printer response
Returns
std::vector<std::string>*
Sample
std::vector<std::string>* linkLocal = GetPrinterList_IPv6("fe80::208:96ff:fe40:", "eth0", 1000);
std::vector<std::string>* global = GetPrinterList_IPv6("2001:b030:2219:c40:208:96ff:fe40:", "", 1000);
std::vector< std::string > * GetPrinterList_IPv6(std::string PREFIX, std::string INTERFACE_NAME, int responseTimeoutMs=2000)
Search a printer by IPv6 network.
Definition Discovery.cpp:161

Variable Documentation

◆ g_listMutex

std::mutex g_listMutex