cec - cec_demo1 Demo

Description

This sample runs the daemon for communication via StreetPass.
The demo sets data in the StreetPass box, searches for a StreetPass partner, and exchanges data.
At least two CTR systems are required to run this demo.

Required Environment

None.

How to Use

Input Operation
A Button Adds one instance of data to the outbox.
To add data, the StreetPass box must already be open.
B Button Displays the current usage status of the inbox and outbox.
To display status, the StreetPass box must already be open.
Up on the +Control Pad Opens the StreetPass box.
Down on the +Control Pad Closes the StreetPass box.
X Button Deletes one message in the outbox. Messages are deleted beginning from the top of the outbox.
Y Button Deletes all messages in the inbox.
START Button The demo closes after all data in the StreetPass box is deleted.
Close the system The system will enter Sleep Mode. Opening the system restores it to the waking state.

Notes

Use $CTR-SDK/tools/TargetTools/CTR-TS/Development/CecLotcheckTool.[cia|csu] to reset the list of the CTR that is performing StreetPass.

Execution Procedure

This section describes the procedure required when using two CTR systems. Perform the same steps on both systems.

The following log is displayed when the demo is run.

START: nnMain @ c:\SampleDemos\cec\cec_demo1\cec_Main.cpp (Build: Dec 17 2010 09:41:23)
Cec: nn::cec::Initialize()
---- Cec Demo ----
A: Write data
B: Show box data
UP   : Open  Box
DOWN : Close Box
X    : Delete OutBox Message
Y    : Delete All InBox Messages
START: Delete Box and Exit
-------------------

StreetPass communication is not carried out if there is no StreetPass data in the outbox.
First, press Up on the +Control Pad to open the StreetPass box.
A log such as the following is displayed.

Cec: Open MessageBox
CecTest_CreateAndOpenBox : START
CecTest_CreateAndOpenBox(158): Open Box[0x01223300] Failed. 
CecTest_CreateAndOpenBox(161): Box Not Found. -> Create [0x01223300]
CecTest_CreateAndOpenBox(216): Open Box [0x01223300]. 
CecTest_CreateAndOpenBox : END

Next, press the A Button to add StreetPass data to the outbox.
A log such as the following is displayed.

CecTest_CreateMessage : START
Put Mess OutBox[223C5DC2AC03C352] 
CecTest_CreateMessage : END

Press the B Button to confirm that the data has been registered to the outbox.
A log such as the following is displayed.

GetMessageBoxInfoFlag: 0x01
GetBoxSizeMax: 		IN: 524288		OUT: 524288
GetBoxSize:    		IN:      0		OUT:  36256
GetMessNumMax: 		IN:     99		OUT:     99
GetMessNum:    		IN:      0		OUT:      1
GetGroupNumMax:		IN:     99		OUT:     99
 OUTBOX Message[0]
  GetMessageMessId [223C5DC2AC03C352]
  GetMessageMessSize:         36256
  GetMessageBodySize:         32768
  GetMessageGroupId:          0
  GetMessageSessionId:        0
  GetMessageMessTypeFlag:     0x01
  GetMessageSendMode:         0x03
  GetMessageSendCount:        255
  GetMessagePropagationCount: 1
  GetMessIndex:               0

Check that StreetPass data has been registered to the outbox, and then press Down on the +Control Pad to close the StreetPass box.

Cec: Close MessageBox

StreetPass communication will start.
After StreetPass starts, the wireless LED indicator will start flashing for several seconds. Do nothing during this period.
When StreetPass communication occurs, a log such as the following is displayed.

============= Receive Check!!!!!! ============= 
<<AWAKE>>
 Recv Count:[1] Num:[1] 
(00)[2011/01/01(6) 00:29:43.0946][0x01223300][HoE7P-B-988]
=============================================== 

Press Up on the +Control Pad to open the StreetPass box.。
After that, press the B Button to confirm that StreetPass data has been received in the inbox of the receiving CTR.
A log such as the following is displayed.
The following log shows that one instance of data has been registered to the outbox and one to the inbox.

Cec: Open MessageBox
CecTest_CreateAndOpenBox : START
CecTest_CreateAndOpenBox(216): Open Box [0x01223300]. 
CecTest_CreateAndOpenBox : END
 ===== (00) messageId [1E813B3FF07FF7CF]
  Icon size:3200
   Len[32]----------
    55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55  UUUUUUUU UUUUUUUU
    55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55  UUUUUUUU UUUUUUUU
   
   ----------
  Info Str: Message:CEC_DEMO_1
  Send Count: 255
  Propagation Count: 0
  Data body Size: 32768
   Len[32]----------
    04 04 04 04 04 04 04 04  04 04 04 04 04 04 04 04  ........ ........
    04 04 04 04 04 04 04 04  04 04 04 04 04 04 04 04  ........ ........
   
   ----------
GetMessageBoxInfoFlag: 0x01
GetBoxSizeMax: 		IN: 524288		OUT: 524288
GetBoxSize:    		IN:  36256		OUT:  36256
GetMessNumMax: 		IN:     99		OUT:     99
GetMessNum:    		IN:      1		OUT:      1
GetGroupNumMax:		IN:     99		OUT:     99
 INBOX Message[0]
  GetMessageMessId [1E813B3FF07FF7CF]
  GetMessageMessSize:         36256
  GetMessageBodySize:         32768
  GetMessageGroupId:          0
  GetMessageSessionId:        1434417002
  GetMessageMessTypeFlag:     0x01
  GetMessageSendMode:         0x03
  GetMessageSendCount:        255
  GetMessagePropagationCount: 0
  GetMessIndex:               0
 OUTBOX Message[0]
  GetMessageMessId [223C5DC2AC03C352]
  GetMessageMessSize:         36256
  GetMessageBodySize:         32768
  GetMessageGroupId:          0
  GetMessageSessionId:        0
  GetMessageMessTypeFlag:     0x01
  GetMessageSendMode:         0x03
  GetMessageSendCount:        255
  GetMessagePropagationCount: 1
  GetMessIndex:               0

After confirming that data has been exchanged via StreetPass, end the demo.
To delete all data in the StreetPass box and then end the demo, press the START button. A log such as the following is displayed at this time.

Cec: delete Box
Cec: END : nnMain @ c:\SampleDemos\cec\cec_demo1\cec_Main.cpp

Revision History

2011/04/14
Added explanation that StartScanning(true) is enabled in debugging mode.
2011/02/16
Added that the CecLotcheckTool is included in the SDK package.
2011/02/02
Initial version.

CONFIDENTIAL