Пример #1
0
int main(int argc, char *argv[]) {
	printf("Test Generic Tuner Plugin\n");

	printf("Open Device\n");
	OpenDevice(1);

	printf("Creating Test Remote\n");
	remote *rem = CreateRemote((unsigned char *)"testremote");
	SetRemoteName("testremote");

	if (CanMacroTune()) {
		printf("Test Macro Tune\n");
		MacroTune(1, 256);
	}

	printf("Playing Command\n");
	PlayCommand((unsigned int)1, rem, (unsigned char *)"ENTER", 1);

	printf("Freeing Test Remote\n");
	free(rem);

	printf("Close Device\n");
	CloseDevice(1);
	return 0;
}
Пример #2
0
/**
 * Open a message store with best access.
 *
 * @param[in]	sEntryId
 *					The entryid of the store to open.
 * @param[in]	ulFlags
 * 					Flags that are passed on to OpenMsgStore
 * @param[out]	lppMsgStore
 *					Pointer to a IMsgStore pointer that will be assigned the
 *					address of the returned message store.
 *
 * @return HRESULT
 */ 
HRESULT ArchiverSession::OpenStore(const entryid_t &sEntryId, ULONG ulFlags, LPMDB *lppMsgStore)
{
	HRESULT hr = hrSuccess;
	MsgStorePtr ptrUserStore;
	ArchiverSessionPtr ptrSession;
	
	if (sEntryId.isWrapped()) {
		entryid_t sTempEntryId = sEntryId;
		std::string	strPath;

		sTempEntryId.unwrap(&strPath);

		m_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Archive store entryid is wrapped.");
		
		hr = CreateRemote(strPath.c_str(), m_lpLogger, &ptrSession);
		if (hr != hrSuccess) {
			m_lpLogger->Log(EC_LOGLEVEL_INFO, "Failed to create ArchiverSession on '%s' (hr=%s)", strPath.c_str(), stringify(hr, true).c_str());
			goto exit;
		}
		
		hr = ptrSession->OpenStore(sTempEntryId, ulFlags, lppMsgStore);		
	} else {	
		hr = m_ptrSession->OpenMsgStore(0, sEntryId.size(), sEntryId, &ptrUserStore.iid, ulFlags, &ptrUserStore);
		if (hr != hrSuccess) {
			m_lpLogger->Log(EC_LOGLEVEL_INFO, "Failed to open store. (entryid=%s, hr=%s)", sEntryId.tostring().c_str(), stringify(hr, true).c_str());
			goto exit;
		}
			
		hr = ptrUserStore->QueryInterface(IID_IMsgStore, (LPVOID*)lppMsgStore);
	}
	
exit:
	return hr;
}
Пример #3
0
static void amaobj(char path[], char filename[])
{
  char command[stringsize], s[stringsize], *words[stringsize];
  int k, handle = -1, count;
  bool echo = False;
  
  InitOptions(False, path);
  CreateInterpreter();
  if(!Load(filename) || !InitRemote()) return;
  for(;;)
  {
    getstring(">> ", command);
    if(echo) WriteString(command);
    WriteString("\n");
    count = FindWords(command, words, stringsize);
    if(count == 2 && strcmp(words[0], "object") == 0)
    {
      DropRemote(handle);
      handle = CreateRemote(words[1]);
    }
    else if(count >= 2 && strcmp(words[0], "call") == 0)
    {
      if(handle < 0)
        WriteString("No object selected");
      else
      {
        starttiming();
        for(k=2; k < count; k++) PutRemote(handle, words[k]);
        CallRemote(handle, words[1]);
        WriteString("<\n");
        while(GetRemote(handle, s, stringsize))
        {
          WriteString(s);
          WriteString("\n");
        }
        WriteString(">\n");
        stoptiming();
      }
    }
    else if(count == 1 && strcmp(words[0], "echo") == 0)
      echo = !echo;
    else if(count == 1 && strcmp(words[0], "time") == 0)
      timing = !timing;
    else if(count == 1 && strcmp(words[0], "exit") == 0)
      break;
    else
      WriteString("???\n");
    WriteString("\n");
  }
}
Пример #4
0
void OpenClient( void )
{
	PSOCKADDR pAddr;
	if( l.flags.bUDP )
	{
		pAddr = CreateSockAddress( WIDE("127.0.0.1:10005"), 10005 );
      l.pClient = ConnectUDPAddr( pAddr, l.pAddr, UDPClientRead, NULL );
	}
	else
	{
		if( l.flags.bUnix )
			pAddr = CreateRemote( WIDE("./TestSocket"), 0 );
		else
			pAddr = CreateSockAddress( WIDE("127.0.0.1:10000"), 10000 );
		l.pClient = OpenTCPClientAddrEx( pAddr, ClientReadComplete, NULL, NULL );
      SetTCPNoDelay( l.pClient, 1 );
	}
}
Пример #5
0
void OpenServer( void )
{
	PCLIENT pServer;
	PSOCKADDR pAddr;
	if( l.flags.bUDP )
	{
		l.pAddr = CreateSockAddress( WIDE("127.0.0.1:10001"), 10001 );
      pServer = ServeUDPAddr( l.pAddr, UDPServerRead, NULL );
	}
	else
	{
		if( l.flags.bUnix )
			pAddr = CreateRemote( WIDE("./TestSocket"), 0 );
		else
			pAddr = CreateSockAddress( WIDE("127.0.0.1:10000"), 10000 );
		pServer = OpenTCPListenerAddrEx( pAddr, Connected );
      SetTCPNoDelay( pServer, 1 );
	}
}
Пример #6
0
SaneWinMain( argc, argv )
{
	if( argc < 1 )
	{
		printf( WIDE("Usage: %s <name>\n"), argv[0] );
      return 1;
	}
   if( NetworkWait(NULL,1,0) )
	{
		SOCKADDR *sa = CreateRemote( argv[1], 5555 );
		uint32_t IP;
		GetAddressParts( sa, &IP, NULL );

		printf( WIDE("%")_32f WIDE(".%")_32f WIDE(".%")_32f WIDE(".%")_32f WIDE("")
				, (IP & 0xFF)
				, (IP & 0xFF00) >> 8
				, (IP & 0xFF0000) >> 16
				, (IP & 0xFF000000) >> 24
				);
	}
Пример #7
0
/*
 * Programs have to call this to get the super interface
 * which is needed to access other functions
 */
DFBResult
DirectFBCreate( IDirectFB **interface )
{
     DFBResult  ret;
     IDirectFB *dfb;
     CoreDFB   *core_dfb;

     if (!dfb_config) {
          /*  don't use D_ERROR() here, it uses dfb_config  */
          direct_log_printf( NULL, "(!) DirectFBCreate: DirectFBInit "
                             "has to be called before DirectFBCreate!\n" );
          return DFB_INIT;
     }

     if (!interface)
          return DFB_INVARG;

     if (idirectfb_singleton) {
          idirectfb_singleton->AddRef( idirectfb_singleton );
          *interface = idirectfb_singleton;
          return DFB_OK;
     }

     direct_initialize();

     if ( !(direct_config->quiet & DMT_BANNER) && dfb_config->banner) {
          direct_log_printf( NULL,
                             "\n"
                             "   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB " DIRECTFB_VERSION " |~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
                             "        (c) 2001-2009  The world wide DirectFB Open Source Community\n"
                             "        (c) 2000-2004  Convergence (integrated media) GmbH\n"
                             "      ----------------------------------------------------------------\n"
                             "\n" );
     }

     if (dfb_config->remote.host)
          return CreateRemote( dfb_config->remote.host, dfb_config->remote.session, interface );

     ret = dfb_core_create( &core_dfb );
     if (ret)
          return ret;

     DIRECT_ALLOCATE_INTERFACE( dfb, IDirectFB );

     ret = IDirectFB_Construct( dfb, core_dfb );
     if (ret) {
          dfb_core_destroy( core_dfb, false );
          return ret;
     }

     if (dfb_core_is_master( core_dfb )) {
          /* not fatal */
          ret = dfb_wm_post_init( core_dfb );
          if (ret)
               D_DERROR( ret, "DirectFBCreate: Post initialization of WM failed!\n" );

          dfb_core_activate( core_dfb );
     }

     *interface = idirectfb_singleton = dfb;

     return DFB_OK;
}
Пример #8
0
TCOMIDoxNG CoDoxNG::CreateRemote(LPWSTR machineName)
{
  TCOMIDoxNG _intf;
  CreateRemote(machineName, _intf);
  return _intf;
};