/*---------------------------------------------------------------------------* Project: Horizon File: demo_AcTestMain.cpp Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev:$ *---------------------------------------------------------------------------*/ #include static size_t STACK_SIZE = 4096; static nn::os::Event s_DisconnectEvent(false); extern "C" void DisconnectWaitThread() { NN_LOG( "Start to wait for a disconnect event.\n" ); s_DisconnectEvent.Wait(); NN_LOG( "Signal disconnect event!\n" ); } extern "C" void nnMain( void ) { // Call only nn::applet::Enable to also allow execution from the HOME Menu // HOME Menu transitions, POWER Button presses, and sleep are all unsupported nn::applet::Enable(); nn::Result result; nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMicroSeconds(1200)); NN_LOG("client: Initialize AC\n"); nn::fs::Initialize(); result = nn::ac::Initialize(); if( result.IsSuccess() ) { nn::ac::Config config; nn::ac::CreateDefaultConfig( &config ); nn::ac::RegisterDisconnectEvent( &s_DisconnectEvent ); nn::os::Thread thread; thread.StartUsingAutoStack( DisconnectWaitThread, STACK_SIZE ); thread.Detach(); NN_LOG("client: Connecting\n"); result = nn::ac::Connect( config ); if( result.IsSuccess() ) { // Connection successful NN_LOG("Successfully connected.\n"); NN_LOG("client: Close\n"); nn::ac::Close(); } else { // Connection failure NN_LOG("Connection failed.\n"); } } else { NN_LOG("client: Initialization failure\n"); } NN_LOG("client: Finalize AC\n"); nn::ac::Finalize(); NN_LOG("Exit client\n"); while(true) { nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromSeconds(1)); } }