i thought maybe the IP-Set and NetMask set needs a pointer, so i tried this:
#include <mios32.h>
#include "app.h"
#include "uip.h"
#include <uip_task.h>
#include <osc_client.h>
#include "terminal.h"
//set Device IP
u32 deviceIP[4] = {1, 2, 3 ,4};
u32 *deviceIPpointer;
//set UIP_TASK_Netmask
u32 Netmask[4] = {255,255,255,0};
u32 *NetmaskPointer;
void APP_Init(void)
{
// init terminal
TERMINAL_Init(0);
UIP_TASK_Init(0);
//Set Pointer
//Connection Setup
UIP_TASK_DHCP_EnableSet(0);
UIP_TASK_IP_AddressSet(1.1); //Host IP-Adress
//uip_ipaddr1(1.0.0.0); //pointer?
//uip_ipaddr2(2); //pointer?
//uip_ipaddr2(3); //pointer?
//uip_ipaddr2(4); //pointer
NetmaskPointer = Netmask;
UIP_TASK_NetmaskSet(NetmaskPointer);
deviceIPpointer = deviceIP;
OSC_SERVER_RemoteIP_Set(1, deviceIPpointer); //connections, IP
OSC_SERVER_RemotePortSet(1, 5001); //connection 0-3, port
OSC_SERVER_LocalPortSet(1, 5000); //connection 0-3, port
OSC_CLIENT_TransferModeSet(1, 0); //selected_osc_con, ocfg_value
UIP_TASK_GatewaySet(1.1); //ip
UIP_TASK_UDP_MonitorLevelSet(1); //outputs data to Mios-Studio ---0 turn off
OSC_SERVER_Init(0);
OSC_CLIENT_Init(0);
}
give me back: app.c:32:4: warning: passing argument 1 of ‘UIP_TASK_NetmaskSet’ makes integer from pointer without a cast [enabled by default]
ok it dont needs a pointer, …it takes a singel integer…maybe i have to write the 001. instead of 1.? lets have a try:
I want IP adress for Connection 1 (0-3) 001.000.000.000), I write it witouts points:
OSC_SERVER_RemoteIP_Set(1, 001000000000); //connections, IP
The System Command in Mios-Studio give me back: [9996.317] OSC2 Remote address: 8.0.0.0
from 001000000000 to 8.0.0.0 ??? what goes on...
OSC_SERVER_RemoteIP_Set(1, 008000000000); //connections, IP
give me back: app.c:34:31: error: invalid digit “8” in octal constant
octal constant? whats that…ask google: ohh deep in wonderland…if i write bevore a number a 0 it is a treated as a octal constant by the compiler…
so lets try: with that converter: http://www.binaryhexconverter.com/decimal-to-octal-converter 150 Decimal gets 226 octal… lets try this
OSC_SERVER_RemoteIP_Set(1, 0226000000000)
give me back: app.c:34:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
ok ok, but
010 octal is 8 decimal
001000000000 is 8.0.0.0
since 0 stand for octal, i dont write the zero:
010… AHA ok lets try a different ip:
OSC_SERVER_RemoteIP_Set(1, 001002003004); //
since 0-7 octal = 0-7 decimal it should output 1.2.3.4
nope 8.8.6.4!
pffffff ok wrong direction… i go to bed now..
…ok cant sleep, back again:
001000000000 = 8.0.0.0
0010 = 8 so 8.8.8.8 should be
0010 0010 0010 0010? lets try > 0010001000100010
no: app.c:34:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
0100010001000100 > warning: large integer implicitly truncated to unsigned type [-Woverflow] > 0100 0100 0100 0100 > thougt that would bring me 64.64.64.64 … but nope
10010010010 > warning: large integer implicitly truncated to unsigned type [-Woverflow]
0010010010010 > 64.32.16.8
010010010010 > 64.32.16.8
try to analyze this:
64 dec = 100 octal > looks right since 0 100 100 100 10
32 dec = 40 octal no sense
16 dec = 20 octal
8 dec = 10 octal > looks right since 0 100 100 100 10
hm lets try this:
0 100010 > 0.0.128.8 10oct = 8dec, but 128?—no clue
0 10010 > 0.0.16.8
0 1010 > 0.0.2.8 > 10oct = 8dec, but 2?— no clue
0 110 > 0.0.0.72 > 110oct = 72dec
0 10 > 0.0.0.8 > 10oct = 8dec
no that makes no sense,
try out the binary 64:
01000000 > 0.4.0.0 >>> hmm 64… 4? happy accident? lets try the binary 128
010000000 > 0.32.0.0 — no clue… maybe without zero (dont declare it as octal)
10000000 > 0.152.150.128 …ähm — the first ip adress…ok what happens if i simply write the decimal 128:
128 > 0.0.0.128
ok maybe i missunderstand the word connections… and i have to do this:
OSC_SERVER_RemoteIP_Set(0, 128);
OSC_SERVER_RemoteIP_Set(1, 128);
OSC_SERVER_RemoteIP_Set(2, 128);
OSC_SERVER_RemoteIP_Set(3, 128);
nope give me [16184.888] OSC4 Remote address: 0.0.0.128 4times… connections are connections and not numbers in the ip… hmmmm wahhh
hm maybe the Server needs some spacing between the integers:
OSC_SERVER_RemoteIP_Set(0, 128/128/128/128);
nope give me 0.0.0.0
ok 128128128128 and ignoring the “large integer…” >>> [16505.159] OSC1 Remote address: 213.8.20.128 >>> no clue
ok then have a look again in the OSC_SERVER - where i dont understand anything…go to that IP_Set..:
s32 OSC_SERVER_RemoteIP_Set(u8 con, u32 ip){
if( con >= OSC_SERVER_NUM_CONNECTIONS )
return -1; // invalid connection
osc_remote_ip[con] = ip;
#if 0
return OSC_SERVER_Init(0);
#else
return 0; // OSC_SERVER_Init(0) has to be called after all settings have been done
#endif}
hm it can be only that: “osc_remote_ip[con] = ip”
ip is the input that i wan to set from my application…thats what i try and try and try…here it stands it want a u32 integer… so the only variable that i say that could tell me what is going on is “osc_remote_ip” seek this:
// TODO: variable initialisation contains hardcoded dependency to OSC_SERVER_NUM_CONNECTIONS!
static u32 osc_remote_ip[OSC_SERVER_NUM_CONNECTIONS] = { OSC_REMOTE_IP, OSC_REMOTE_IP, OSC_REMOTE_IP, OSC_REMOTE_IP };
what? ok ok… this is a arry with variable size, and its initalized 4times with the same Variable/Value… ähm ok a idea:
OSC_SERVER_RemoteIP_Set(4, 128, 128, 128, 128); >>>> nope …that isnt it again… ok seek more in osc_remote_ip:
for(con=0; con<OSC_SERVER_NUM_CONNECTIONS; ++con) {
uip_ipaddr_t ripaddr;
uip_ipaddr(ripaddr,
((osc_remote_ip[con])>>24) & 0xff,
((osc_remote_ip[con])>>16) & 0xff,
((osc_remote_ip[con])>> 8) & 0xff,
((osc_remote_ip[con])>> 0) & 0xff);
ok i have seen this bevore… bevore i testetd all this.. i testet all this because i dont understand that… i have googled what the & 0xff is (it some “to be shure that nobody make mess with variable declaration like u8 u16” or so thing - dont know i think it dont matter
with this for thing it looks like a modem dial mechanismus… this"ripaddr" looks a pointer the uip_ipaddr_t like an structure…hm idea i did not try a structure… but i must to bed, a quick look into structure -tutorials (again, looked in structure about 10 times dont understand it anytime) …nope i dont learn that today
nope
ok take a look again in the terminal.c found this:
if( OSC_SERVER_RemoteIP_Set(con, ip) >= 0 ) {
out("Set OSC%d Remote address to %d.%d.%d.%d",
con+1,
(ip>>24)&0xff, (ip>>16)&0xff, (ip>>8)&0xff, (ip>>0)&0xff);
OSC_SERVER_Init(0);
what take my interest is that >>24 >>16 >>8 >>0 thing - that could be the wright direction >> google says: >> used for BIT-FLAGS… ok with the test results from above that could be really the way to go!
but thats some good night lecture for tomorrow: http://www.codeproject.com/Articles/13740/The-Beginner-s-Guide-to-Using-Enum-Flags