[Tinyos-help] Getting error : incompatible types in assignment

Faisal Aslam aslam at informatik.uni-freiburg.de
Wed Jul 29 05:06:30 PDT 2009


Hi,

The variable out should be a pointer. Hence
Instead of
SensorMessage1_t out;
Use
SensorMessage1_t* out;

best regards,
Faisal Aslam



himanshu barve wrote:
> From header file
> -----------------------------------------------------------------------------------
> typedef nx_struct SensorMessage1 {
>  
>   nx_int32_t reading1;
>    nx_int32_t reading2;
>    nx_int32_t reading3;
>   nx_int32_t reading4;
>    nx_int32_t reading5;
>   
>   
>   
> } SensorMessage1_t;
> ---------------------------------------------------------------------------------
>
>
>
> From Module file
> -------------------------------------------------------------------------------------
> event message_t* Receive.receive(message_t* msg, void *payload, 
> uint8_t len) 
>   {
>     
>      SensorMessage1_t* in = (SensorMessage1_t*)payload;
>      SensorMessage1_t out;
>      call Leds.led0Toggle();
>      if (uartbusy == FALSE) 
>      {
>        out = (SensorMessage1_t*)call SerialSend.getPayload(&uartpkt, 
> sizeof(SensorMessage1_t));
>        if (len != sizeof(SensorMessage1_t) || out == NULL) 
>        {
> return msg;
>        }
>        else 
>        {
> memcpy(out, in, sizeof(SensorMessage1_t));
>        }
>        uartlength = sizeof(SensorMessage1_t);
>      post uartSendTask();
>      }
> return msg ; 
> }
> --------------------------------------------------------------------
>
>
> Error message 
>
> In file included from Root_MoteAppC.nc:15:
> In component `Root_MoteC':
> Root_MoteC.nc: In function `Receive.receive':
> Root_MoteC.nc:110: incompatible types in assignment
> Root_MoteC.nc:111: invalid operands to binary ==
> Root_MoteC.nc:117: incompatible type for argument 1 of `memcpy'
> Root_MoteC.nc:134: incompatible types in assignment
> Root_MoteC.nc:135: invalid operands to binary ==
> Root_MoteC.nc:139: incompatible type for argument 1 of `memcpy'
> /opt/tinyos-2.x/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: 
> #warning "*** L
> OW POWER COMMUNICATIONS DISABLED ***"
> make: *** [exe0] Error 1
> -----------------------------------------------------------------------------------------
>
>
> What might be the problem in this case ?? 
> thanks in advance .. 
>
>
>
>
> -- 
> With Best Regards
> Himanshu Barve
> M.Tech Electrical Engineering (Power System)
> IIT Kharagpur , West Bengal , India
> Ph: - +91 9775201181
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



More information about the Tinyos-help mailing list