Ik heb een opn2001 barcode scanner gekocht en wil hier producten mee gaan scannen.
Aangezien ik 2 scanners gebruik wil ik bijhouden door welke scanner de producten zijn gescand hier voor wil ik het DeviceID gebruiken aangezien deze uniek is.
Ik krijg echter de variabale niet op zen plek en zijn vaak de fout: undeclared identifier.
In de SDK staat: csp2GetDeviceId
Complete SDK
Ik ben een noob op het gebied van C++ ik hoop dat jullie me kunnen helpen.
Alvast bedankt
Aangezien ik 2 scanners gebruik wil ik bijhouden door welke scanner de producten zijn gescand hier voor wil ik het DeviceID gebruiken aangezien deze uniek is.
Ik krijg echter de variabale niet op zen plek en zijn vaak de fout: undeclared identifier.
In de SDK staat: csp2GetDeviceId
Code:
void COPN2001_DEMODlg::OnBnClickedBtnGetBarcode()
{
long lRet, lAsciiMode, lRTC;
char szBarcode[ 256 + 1 ];
char szDeviceID[8 + 1];
int len;
CString strTemp;
lRet = csp2ReadData();
if( lRet > 0L )
{
// Get packet type (ASCII/Binary)
lAsciiMode = csp2GetASCIIMode();
// Get TimeStamp setting (on/off)
lRTC = csp2GetRTCMode();
// lRet contains the number of barcodes in the OPN-2001
long lTotalBarcodes = lRet;
m_listBcdData.ResetContent();
strTemp.Format( L"Read %ld Barcodes", lRet );
m_listBcdData.AddString( strTemp );
HANDLE hFile = INVALID_HANDLE_VALUE;
if( m_bSaveToFile )
{
hFile = CreateFile( m_strSaveFile, // path + filename
GENERIC_READ | GENERIC_WRITE, // open for reading and writing
0, // do not share
NULL, // no security
OPEN_ALWAYS, // Open the file create new when not existing
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
}
if( hFile != INVALID_HANDLE_VALUE )
SetFilePointer( hFile, 0, NULL, FILE_END); // set file pointer to end for appending
for( long lCount = 0L; lCount < lTotalBarcodes; lCount++ )
{
lRet = csp2GetPacket( szBarcode, lCount, sizeof( szBarcode ));
if( lRet > 0L )
{
ConvertBarcodeToString( szBarcode, strTemp, lAsciiMode, lRTC );
m_listBcdData.AddString( strTemp );
if( hFile != INVALID_HANDLE_VALUE )
{
DWORD dwWr;
len = sprintf_s( szBarcode, sizeof( szBarcode ) -1, "%S\r\n", strTemp );
WriteFile( hFile, szBarcode, len, &dwWr, NULL );
}
}
}
if( hFile != INVALID_HANDLE_VALUE )
CloseHandle( hFile );
}
else if( lRet == 0L )
{
m_listBcdData.ResetContent();
m_listBcdData.AddString( L"No barcodes available" );
}
}
void COPN2001_DEMODlg::OnBnClickedBtnClearBarcode()
{
long lRet;
lRet = csp2ClearData();
if( lRet != STATUS_OK )
{
ShowErrorMessage( lRet );
}
}
Complete SDK
Ik ben een noob op het gebied van C++ ik hoop dat jullie me kunnen helpen.
Alvast bedankt