当前位置: 首页>>代码示例>>C++>>正文


C++ GetSerialNumber函数代码示例

本文整理汇总了C++中GetSerialNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSerialNumber函数的具体用法?C++ GetSerialNumber怎么用?C++ GetSerialNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetSerialNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetSerialNumber

// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
{
    VmbErrorType    res;
    VmbUint32_t     nLength;

    res = GetSerialNumber( NULL, nLength );
    if ( VmbErrorSuccess == res )
    {
        if( 0 != nLength)
        {
            try
            {
                std::vector<std::string::value_type> tmpSerial( nLength + 1, '\0');
                res         = GetSerialNumber( &tmpSerial[0], nLength );
                if( VmbErrorSuccess == res )
                {
                    rStrSerial  = &*tmpSerial.begin();
                }
            }
            catch(...)
            {
                return VmbErrorResources;
            }
        }
        else
        {
            rStrSerial.clear();
        }
    }

    return res;
}
开发者ID:gaobo9109,项目名称:sick-lidar,代码行数:33,代码来源:Interface.hpp

示例2: throw

/************************************************************************//**
 * \brief Writes a USB transfer frame down to the Manta
 * \param   frame          Pointer to the frame to be transmitted
 * \param   forceQueued    Forces this message to be queued instead of merged
 *
 * WriteFrame() is meant to be called by the Manta subclass, which defines
 * methods for the individual messages (setLED, etc). libmanta maintains a
 * message queue that gets popped from in the HandleEvents() handler.
 *
 * The default behavior is that if a message is already queued up for a given
 * Manta, subsequent message will be merged into the waiting message instead of
 * being further queued (the queued frame will be the end result of all queued
 * messages). forceQueued can be set to true to force the message to be queued
 * as a separate message instead of being merged
 *
 * Note: Because WriteFrame() accesses the same message queue that
 * HandleEvents() does, they should be protected from each other by a mutex on
 * the application level if they're being called from parallel threads.
 ****************************************************************************/
void MantaUSB::WriteFrame(uint8_t *frame, bool forceQueued)
{
   if(NULL == DeviceHandle)
   {
      throw(MantaNotConnectedException(this));
   }
   MantaTxQueueEntry *queuedMessage = GetQueuedTxMessage();
   if(queuedMessage && !forceQueued)
   {
      /* replace the queued packet payload with the new one */
      for(int i = 0; i < OutPacketLen; ++i)
      {
         /* the first byte of the report is the report ID (0x00) */
         queuedMessage->OutFrame[i+1] = frame[i];
      }
      DebugPrint("%s-%d: (WriteFrame) Queued Transfer overwritten on Manta %d",
            __FILE__, __LINE__, GetSerialNumber());
   }
   else
   {
      /* no transfer in progress, queue up a new one */
      MantaTxQueueEntry *newMessage = new MantaTxQueueEntry;
      newMessage->OutFrame[0] = 0;
      newMessage->TargetManta = this;
      /* the first byte of the report is the report ID (0x00) */
      memcpy(newMessage->OutFrame + 1, frame, OutPacketLen);
      txQueue.push_back(newMessage);
      DebugPrint("%s-%d: (WriteFrame) Transfer Queued on Manta %d",
            __FILE__, __LINE__, GetSerialNumber());
   }
}
开发者ID:LFSaw,项目名称:libmanta,代码行数:50,代码来源:MantaUSB.cpp

示例3: HandleNewCardFound

CK_RV HandleNewCardFound(HWND hTextEdit, CK_FUNCTION_LIST_PTR functions,
									CK_ULONG ulCounter, CK_SLOT_ID_PTR pSlotList,
									PCCERT_CONTEXT*	ppCertContext, CK_ULONG certContextLen)
{
	CK_RV retVal = CKR_OK; 
	CK_SESSION_HANDLE session_handle;

	retVal = (functions->C_OpenSession)(pSlotList[ulCounter], CKF_SERIAL_SESSION, NULL_PTR, NULL_PTR, &session_handle);
	if (retVal == CKR_OK)
	{
		CK_ULONG ulserialNumberLen = 20;
		CK_BYTE_PTR serialNumber = (CK_BYTE_PTR)malloc (ulserialNumberLen*sizeof(CK_BYTE));

		if(serialNumber != NULL)
		{
			//get serial number of the card
			retVal =  GetSerialNumber(hTextEdit, functions, &session_handle, serialNumber,&ulserialNumberLen);
			if (retVal == CKR_OK)
			{	
				//register certificates of the card		
				retVal = GetAndRegisterCertificates(hTextEdit, functions, &session_handle, serialNumber, ulserialNumberLen, ppCertContext, certContextLen);
			}
		}
		retVal = (functions->C_CloseSession) (session_handle);			
	}
	return retVal;
}
开发者ID:Andhr3y,项目名称:dcfd-mw-applet,代码行数:27,代码来源:carddata.c

示例4: test1

int test1() {
  word retval;
  dword serialno;
  if (1!=OpenDLL(dtHandyscope3)) {
    printf("failed loading dlls\n");
    return 1;
  }

  retval=InitInstrument(0);
  if (retval!=NO_ERROR) {
    printf("failed to initialize the instrument, code=%d\n", retval);
    CloseDLL();
    return 1;
  }

  retval=GetSerialNumber(&serialno);
  if (retval!=NO_ERROR) {
    printf("could not read serial number, code=%d\n", retval);
    ExitInstrument();
    CloseDLL();
    return 1;
  }

  printf("serial no %d\n", serialno);

  ExitInstrument();
  CloseDLL();
  return 0;
}
开发者ID:BackupTheBerlios,项目名称:damaris-svn,代码行数:29,代码来源:HS3test.cpp

示例5: ProcessaCMD_HELLO

void ProcessaCMD_HELLO( BYTE * buffer ){

  BYTE bufOut[8];
  BYTE bLog;
  DWORD dwSerNum;
  char i;

  if ( ModemGSM_IsReady() == FALSE ){
    //enviaNACK( buffer[ EO_FIELD ], DONT_CONNECTED  ); 
    return;    
  }
  
  bLog = EVT_SW_HELLO;
  Log( EVT_SW, &bLog, sizeof( BYTE ));  

  dwSerNum = GetSerialNumber();

  // altera o estado do SMS Box para conectado com o Host
  SetStatus( ST_COM_PC_OK );
  
#ifdef USE_SONDA
  // timer para controle de conexão do host
  serialPC_SondaTimer = GetTimer( SONDA_TIMEOUT );
#endif
  
  MakeHeader( bufOut, sizeof( bufOut ), buffer[EO_FIELD], CMD_HELLO );

  for ( i = sizeof( DWORD ) ; i ; i-- )
  {
    bufOut[ CMD_FIELD + (sizeof(DWORD) - (i - 1)) ] = ((BYTE*)&dwSerNum)[(i - 1)];
  } 

  enviarPacotePC( bufOut, sizeof( bufOut ));
}
开发者ID:rdmeneze,项目名称:SMSBox-PIC,代码行数:34,代码来源:SerialPC.c

示例6: NS_LogRelease

NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClass)
{
#ifdef NS_IMPL_REFCNT_LOGGING
  ASSERT_ACTIVITY_IS_LEGAL;
  if (!gInitialized) {
    InitTraceLog();
  }
  if (gLogging == NoLogging) {
    return;
  }
  if (aRefcnt == 0 || gLogging == FullLogging) {
    LOCK_TRACELOG();

    if (aRefcnt == 0 && gBloatLog) {
      BloatEntry* entry = GetBloatEntry(aClass, 0);
      if (entry) {
        entry->Dtor();
      }
    }

    bool loggingThisType = (!gTypesToLog || LogThisType(aClass));
    intptr_t serialno = 0;
    if (gSerialNumbers && loggingThisType) {
      serialno = GetSerialNumber(aPtr, false);
      NS_ASSERTION(serialno != 0,
                   "Serial number requested for unrecognized pointer!  "
                   "Are you memmoving a refcounted object?");
      int32_t* count = GetRefCount(aPtr);
      if (count) {
        (*count)--;
      }

    }

    bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
    if (gRefcntsLog && loggingThisType && loggingThisObject) {
      // Can't use PR_LOG(), b/c it truncates the line
      fprintf(gRefcntsLog,
              "\n<%s> %p %" PRIuPTR " Release %" PRIuPTR "\n",
              aClass, aPtr, serialno, aRefcnt);
      nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
      fflush(gRefcntsLog);
    }

    // Here's the case where MOZ_COUNT_DTOR was not used,
    // yet we still want to see deletion information:

    if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
      fprintf(gAllocLog, "\n<%s> %p %" PRIdPTR " Destroy\n", aClass, aPtr, serialno);
      nsTraceRefcnt::WalkTheStackCached(gAllocLog);
    }

    if (aRefcnt == 0 && gSerialNumbers && loggingThisType) {
      RecycleSerialNumberPtr(aPtr);
    }

    UNLOCK_TRACELOG();
  }
#endif
}
开发者ID:Antonius32,项目名称:Pale-Moon,代码行数:60,代码来源:nsTraceRefcnt.cpp

示例7: Q_UNUSED

QVariant tNDP2kVirtualDeviceInfoParam::GetValueForNDP2k(const unsigned short paramID, const unsigned char destAddress, const unsigned char paramInstance) 
{ 
    Q_UNUSED(paramID);
    Q_UNUSED(destAddress);
    Q_UNUSED(paramInstance);

    QVariant value;

    switch(m_VirtualDeviceInfoParamType)
    {
        case eVirtualDeviceInfoParamType_ProductId :
            value = GetProductId();
            break;

        case eVirtualDeviceInfoParamType_SerialNumber :
            value = GetSerialNumber();
            break;

        case eVirtualDeviceInfoParamType_DeviceInstance :
            value = GetDeviceInstance();
            break;

        case eVirtualDeviceInfoParamType_SystemInstance :
            value = GetSysInstance();
            break;

        default :
            Assert(0);
            break;

    }

    return value;
}
开发者ID:dulton,项目名称:53_hero,代码行数:34,代码来源:tNDP2kVirtualDeviceInfoParam.cpp

示例8: NS_LogCtor

NS_LogCtor(void* aPtr, const char* aType, uint32_t aInstanceSize)
{
#ifdef NS_IMPL_REFCNT_LOGGING
  ASSERT_ACTIVITY_IS_LEGAL;
  if (!gInitialized)
    InitTraceLog();

  if (gLogging) {
    LOCK_TRACELOG();

    if (gBloatLog) {
      BloatEntry* entry = GetBloatEntry(aType, aInstanceSize);
      if (entry) {
        entry->Ctor();
      }
    }

    bool loggingThisType = (!gTypesToLog || LogThisType(aType));
    intptr_t serialno = 0;
    if (gSerialNumbers && loggingThisType) {
      serialno = GetSerialNumber(aPtr, true);
    }

    bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
    if (gAllocLog && loggingThisType && loggingThisObject) {
      fprintf(gAllocLog, "\n<%s> 0x%08X %ld Ctor (%d)\n",
             aType, NS_PTR_TO_INT32(aPtr), serialno, aInstanceSize);
      nsTraceRefcntImpl::WalkTheStack(gAllocLog);
    }

    UNLOCK_TRACELOG();
  }
#endif
}
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:34,代码来源:nsTraceRefcntImpl.cpp

示例9: DriverLog

vr::EVRInitError CHydraHmdLatest::Activate( uint32_t unObjectId )
{
	DriverLog( "CHydraHmdLatest::Activate: %s is object id %d\n", GetSerialNumber(), unObjectId );
	m_unSteamVRTrackedDeviceId = unObjectId;

	g_ServerTrackedDeviceProvider.LaunchHydraMonitor();

	return vr::VRInitError_None;
}
开发者ID:ChristophHaag,项目名称:driver_hydra,代码行数:9,代码来源:driver_hydra.cpp

示例10: NS_LogAddRef

NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
             const char* aClazz, uint32_t classSize)
{
#ifdef NS_IMPL_REFCNT_LOGGING
  ASSERT_ACTIVITY_IS_LEGAL;
  if (!gInitialized)
    InitTraceLog();
  if (gLogging) {
    LOCK_TRACELOG();

    if (gBloatLog) {
      BloatEntry* entry = GetBloatEntry(aClazz, classSize);
      if (entry) {
        entry->AddRef(aRefcnt);
      }
    }

    // Here's the case where MOZ_COUNT_CTOR was not used,
    // yet we still want to see creation information:

    bool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
    intptr_t serialno = 0;
    if (gSerialNumbers && loggingThisType) {
      serialno = GetSerialNumber(aPtr, aRefcnt == 1);
      NS_ASSERTION(serialno != 0,
                   "Serial number requested for unrecognized pointer!  "
                   "Are you memmoving a refcounted object?");
      int32_t* count = GetRefCount(aPtr);
      if(count)
        (*count)++;

    }

    bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
    if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
      fprintf(gAllocLog, "\n<%s> 0x%08X %ld Create\n",
              aClazz, NS_PTR_TO_INT32(aPtr), serialno);
      nsTraceRefcntImpl::WalkTheStack(gAllocLog);
    }

    if (gRefcntsLog && loggingThisType && loggingThisObject) {
      if (gLogToLeaky) {
        (*leakyLogAddRef)(aPtr, aRefcnt - 1, aRefcnt);
      }
      else {
          // Can't use PR_LOG(), b/c it truncates the line
          fprintf(gRefcntsLog,
                  "\n<%s> 0x%08X %ld AddRef %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
          nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
          fflush(gRefcntsLog);
      }
    }
    UNLOCK_TRACELOG();
  }
#endif
}
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:56,代码来源:nsTraceRefcntImpl.cpp

示例11: DebugPrint

/************************************************************************//**
 * \brief Disconnects this instance from an attached Manta
 ****************************************************************************/
void MantaUSB::Disconnect(void)
{
   if(! IsConnected())
   {
      return;
   }

   DebugPrint("%s-%d: Manta %d Disconnecting...", __FILE__, __LINE__, GetSerialNumber());
   hid_close(DeviceHandle);
   DeviceHandle = NULL;
}
开发者ID:LFSaw,项目名称:libmanta,代码行数:14,代码来源:MantaUSB.cpp

示例12: CheckHardwareMatch

/*------------------------------------------------------------------------------------

FUNCTION NAME: CheckHardwareMatch

DESCRIPTION:   Check hardware matching.

PARAMETERS:
  - INPUT
     - HARDWARE_ID_LIST  * pLicense
  - OUTPUT:

RETURN:
  - TRUE : hardware is found
  - FALSE : hardware is not found

NOTES:

------------------------------------------------------------------------------------*/
BOOL  CheckHardwareMatch (HARDWARE_ID_LIST  * pHardwareList)
{
  DWORD                   _logical_drivers;
  DWORD                   _mask_driver;
  DWORD                   _initial_mask_driver;
  char                    _drive_root [MAX_MGL_STRINGS];
  DWORD                   _serial_number;
  BOOL                    _rc_get_serial_number;
  BOOL                    _return_code;
  BYTE                    _idx_drive, _idx_hard;

  // If AnyHardware any hardware is included.
  if ( pHardwareList->AnyHardware )
  {
    return TRUE;
  }

  _return_code = FALSE;
  _logical_drivers = GetLogicalDrives ();

  _initial_mask_driver = 0x00000001;
  // Check all logical drivers founds.
  for ( _idx_drive = 0; _idx_drive < MAX_AVAILABLE_DRIVERS; _idx_drive ++ )
  {
    _mask_driver = _initial_mask_driver << _idx_drive;
    if ( _logical_drivers & _mask_driver )
    {
      sprintf (_drive_root, "%c:\\", 'A' + _idx_drive);
      _rc_get_serial_number  = GetSerialNumber (&_serial_number, _drive_root);

      if ( _rc_get_serial_number && _serial_number > 0 )
      {
        for ( _idx_hard = 0; _idx_hard < pHardwareList->NumberOfHardwares; _idx_hard ++ )
        {
          if ( _serial_number == pHardwareList->HardwareId [_idx_hard] )
          {
            _return_code = TRUE;
            break;
          }
        } /* end for */
      } /* end if */
      
      // If hardware found then exit function
      if ( _return_code )
      {
        break;
      }
    } /* end if */
  } /* end for */

  return _return_code;

} /* CheckHardwareMatch */
开发者ID:bochaqos,项目名称:tol,代码行数:71,代码来源:MGL_ReadLicense.c

示例13: GetSerialNumber

// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
{
    VmbErrorType res;
    VmbUint32_t nLength;

    res = GetSerialNumber( NULL, nLength );
    if ( VmbErrorSuccess == res )
    {
        if ( 0 < nLength )
        {
            rStrSerial.resize( nLength );
            res = GetSerialNumber( &rStrSerial[0], nLength );
        }
        else
        {
            rStrSerial.clear();
        }
    }

    return res;
}
开发者ID:SanderGrielens,项目名称:rapido,代码行数:22,代码来源:Interface.hpp

示例14: _T

int HostIO_CyUSB::OpenEx(CameraID cID)
{
	int		numDevs;
	USHORT	VID;
	USHORT	PID;
	bool	bFoundDevice = false;

	m_log->Write(2, _T("OpenEx name: %s"), cID.SerialToOpen.c_str());
	
	numDevs = cyusb_open();

	for (int i = 0; i < (int)numDevs; i++) 
	{
		h = cyusb_gethandle(i);
		VID = cyusb_getvendor(h);
		PID = cyusb_getproduct(h);

		std::string SerialNum = std::string("None");
		GetSerialNumber(SerialNum);
		std::string SerialToOpen = SerialNum;
		
		std::string Desc = std::string("None");
		GetDesc(Desc);

		m_log->Write(2, _T("Dev %d:"), i);
		m_log->Write(2, _T(" SerialNumber=%s"), SerialNum.c_str());
		m_log->Write(2, _T(" Description=%s"), Desc.c_str());

		if (VID == QSICyVID && PID == QSICyPID && SerialNum == cID.SerialToOpen )
		{
			m_log->Write(2, _T("USB Open found QSI Cy device at index: %d, Serial: %s, Description: %s"), 
							i, SerialNum.c_str(), Desc.c_str());
			bFoundDevice = true;
			break;
		}
	}
	
	if (bFoundDevice && cyusb_kernel_driver_active(h, 0) == 0 && cyusb_claim_interface(h, 0) == 0)
	{
		SetTimeouts(READ_TIMEOUT, WRITE_TIMEOUT);		
	}
	else
	{
		m_log->Write(2, "No devices matched");
	}

	m_log->Write(2, _T("OpenEx Done."));

	return bFoundDevice ? ALL_OK : ERR_USB_OpenFailed;
}
开发者ID:azwing,项目名称:indi,代码行数:50,代码来源:HostIO_CyUSB.cpp

示例15: main

int main(void)
{
    dispBufferOn = ST_WR_FORE;

    GraphicsString(&Table);
    cputsxy(0, 3, CBOLDON "Your Serial Number is:");
    cputhex16(GetSerialNumber());

    DoMenu(&Menu);
    MainLoop();

    // will never reach this point...
    return 0;
}
开发者ID:Michaelangel007,项目名称:cc65,代码行数:14,代码来源:getid.c


注:本文中的GetSerialNumber函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。