#168670 - DarkShadow44 - Thu May 14, 2009 7:30 pm
Hello!
I'm trying to send a struct with the wifi functions, but I can't receive them.
Do you know what's wrong with this code:
The function RawTxFrameAdHoc is from here: http://forum.gbadev.org/viewtopic.php?t=16394&postdays=0&postorder=asc&start=15 (I renamed the function RawTxFrameAdHoc)
Please Help !!!
I'm trying to send a struct with the wifi functions, but I can't receive them.
Do you know what's wrong with this code:
Code: |
#include <nds.h> #include <stdio.h> #include <dswifi9.h> #include <string.h> typedef struct { int a; int b; }structure; structure str1; void Handler(int packetID, int readlength) { structure str2; str2.a=0; str2.b=0; structure* strPtr2=&str2; static int bytesRead; bytesRead = Wifi_RxRawReadPacket(packetID, readlength, (unsigned short*)strPtr2); { iprintf("\x1b[1;0H\n Bytes: %d!\nRcv:%d , %d ", bytesRead,str2.a, str2.b); //Test Received Structure } } int main(void) { consoleDemoInit(); Wifi_InitDefault(false); Wifi_SetPromiscuousMode(1); Wifi_EnableWifi(); Wifi_RawSetPacketHandler(Handler); Wifi_SetChannel(10); iprintf("Press A to start"); while(1) { scanKeys(); int pressed = keysDown(); if(pressed & KEY_A) break; } iprintf("\x1b[0;0H "); int send = 0; int f; str1.a=99; str1.b=34; structure*strPtr1=&str1; while(1) { iprintf("\x1b[0;0HSending %d", send); if(Wifi_RawTxFrameAdHoc(sizeof(structure), 0x0014, (unsigned short*)strPtr1) != 0) { iprintf("\n\nError calling RawTxFrame\n\n"); } send++; for(f = 0 ; f < 6 ; f++) swiWaitForVBlank(); } return 0; } |
The function RawTxFrameAdHoc is from here: http://forum.gbadev.org/viewtopic.php?t=16394&postdays=0&postorder=asc&start=15 (I renamed the function RawTxFrameAdHoc)
Please Help !!!