SENA HD1200 User Manual
Page 48
Starter Kit and User Manual for the HelloDevice 1200
45
length,
0,
(struct
sockaddr*)&clientAddr,
&clientLen
);
if (lenReceived < 0)
{
perror("\nError receiving???\n") ;
exit(0)
;
}
// Store memory status for future use
for (i=0, count=0; i<length; i++)
{
printf("%2.2x:\t", ResponseBuf[i+4]) ;
if (count == 9)
{
count = 0 ;
printf("\n")
;
}
count++
;
}
printf("\n\n")
;
// Display incoming packet size
printf("\n%d bytes received...\n\n", lenReceived) ;
//
Free
free(ResponseBuf)
;
// Close TCP socket
TCPSocketClose()
;
}
//---------------------
// Process DPRAM Write
//---------------------
void DPR_Write()
{
char commandBuf[1450+6+1]="", data[1450+1] ;
int
commandLen
;
int offset, length, tmp ;
int
i,
err
;
printf("\n\nEnter offset in hex (MAX. 0x7FF):") ;
scanf("%x",
&offset)
;
printf("\nEnter length in digit (MAX. 1450):") ;
scanf("%d",
&length)
;
printf("\nEnter value in hex:") ;
scanf("%s",
data)
;
// Re-Initialize TCP socket
TCPSocketInit()
;
// Make TCP command
commandBuf[0]
=
DPRSet;
tmp =offset >> 8 ;
commandBuf[1]
=
tmp;
tmp = offset & 0x00FF ;
commandBuf[2] = tmp ;
tmp = length >> 8 ;