I solved the "Receive.receive not connected", I was puzzled as to why I was
still getting the error when I added the default event in the
/system/NoCRCPacket.nc, the problem was coming from the
/platform/NoCRCPacket.nc directory.  I took care of that.  

Now I'm back to the main problem of trying to use NoCRCPacket's "txBytes"
command in my code.  

In component `MyAppM':
MyAppM.nc:27: unexpected interface reference in declaration of
`NoCRCPacket.txBytes'
MyAppM.nc: In function `Timer.fired':
MyAppM.nc:120: `NoCRCPacket' undeclared (first use in this function)
MyAppM.nc:120: (Each undeclared identifier is reported only once
MyAppM.nc:120: for each function it appears in.)

/**
 * This module shows how to use the Timer, LED, ADC and Messaging
components.
 * Sensor messages are sent to the serial port
 **/
configuration MyApp {
  provides {
        command result_t txBytes(uint8_t *bytes, uint8_t numBytes);
  }
}
implementation {
  components Main, MyAppM, TimerC, LedsC, NoCRCPacket as NoPacket, UART;
  
  Main.StdControl -> TimerC.StdControl;
  Main.StdControl -> MyAppM.StdControl;
  Main.StdControl -> NoPacket.Control;
  
  MyAppM.Timer -> TimerC.Timer[unique("Timer")];
  MyAppM.Leds -> LedsC.Leds;
  
  txBytes = NoPacket.txBytes;
  
  NoPacket.ByteControl -> UART;
  NoPacket.ByteComm -> UART;

}

/*
 * Copyright (c) 2004-2007 Crossbow Technology, Inc.
 * All rights reserved.
 * See license.txt file included with the distribution.
 *
 * $Id: MyAppM.nc,v 1.1.2.4 2007/04/26 19:59:38 njain Exp $
 */

module MyAppM {
  provides {
    interface StdControl;
        
  }
  uses {
    interface Timer;
    interface Leds;
        interface StdControl as PhotoControl;
        interface SendUART;
        
        command result_t NoCRCPacket.txBytes(uint8_t *bytes, uint8_t
numBytes);
//      interface SendData;
  }
}
implementation {
  bool sending_packet = FALSE;

  
  /**
   * Initialize the component.
   * 
   * @return Always returns <code>SUCCESS</code>
   **/
  command result_t StdControl.init() {
    call Leds.init(); 


  /**
   * Start things up.  This just sets the rate for the clock component.
   * 
   * @return Always returns <code>SUCCESS</code>
   **/
  command result_t StdControl.start() {
    // Start a repeating timer that fires every 1000ms
    return call Timer.start(TIMER_REPEAT, 1000);
  }

  /**
   * Halt execution of the application.
   * This just disables the clock component.
   * 
   * @return Always returns <code>SUCCESS</code>
   **/
  command result_t StdControl.stop() {
    return call Timer.stop();
  }

  /**
   * Toggle the red LED in response to the <code>Timer.fired</code> event.  
   * Start the Light sensor control and sample the data
   *
   * @return Always returns <code>SUCCESS</code>
   **/
  event result_t Timer.fired()
  {
    call Leds.redToggle();
        
        if (sending_packet) return SUCCESS;
    atomic sending_packet = TRUE;
    
        // send message to UART (serial) port
        if (call NoCRCPacket.txBytes((uint8_t *)0x41,(uint8_t *)0x01) !=
SUCCESS)
          sending_packet = FALSE;
          
    return SUCCESS;
  }
  

}




-----Original Message-----
From: Michael Schippling [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 18, 2008 10:27 AM
To: Mark Tsang
Cc: tinyos-help@millennium.berkeley.edu
Subject: Re: [Tinyos-help] Utilizing a command from another module,

I'm not the best at config issues, but it seems that something in
NoCRCPacket expects to have a callout function named receive() which
you need to implement when using the module. Maybe one of the nesc
experts can provide an opinion if you attach all your code and error
messages.

MS


Mark Tsang wrote:
> Exactly, I know that I'm able to call txBytes from my own code but I can't
> seem to get it to work because of the error about a connection from within
> NoCRCPacket explained below:  I've searched the documents for areas
> regarding "calling a command from another module" but no luck.  Aside from
> this being my 14th hour working on this project, could you please at least
> direct me to the proper documentation that would explicitly explain the
> syntax to make this command call.  Thanks!  I'm starting to run out of
> ideas.
> 
>  In component `NoCRCPacket':
> 
>  /opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc: In function
>  `receiveTask':
>  /opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc:306: Receive.receive 
>  not connected
> 
> -----Original Message-----
> From: Michael Schippling [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 17, 2008 9:27 PM
> To: Mark Tsang
> Cc: tinyos-help@millennium.berkeley.edu
> Subject: Re: [Tinyos-help] Utilizing a command from another module,
> 
> I may have spoken out of turn but the 'provides' block in the T1 file is:
> 
>> module NoCRCPacket {
>>   provides {
>>     interface StdControl as Control;
>>     interface BareSendMsg as Send;
>>     interface ReceiveMsg as Receive;
>>     interface SendVarLenPacket;
>>
>>     command result_t txBytes(uint8_t *bytes, uint8_t numBytes);
>>     /* Effects: start sending 'numBytes' bytes from 'bytes'
>>     */
>>   }
>>   uses {
>>     interface ByteComm;
>>     interface StdControl as ByteControl;
>>     interface Leds;
>>   }
>> }
> 
> Which seems to indicate that you could "call txBytes(...)" from your code,
> but I'm resistant to becoming familiar with that special syntax.
> If that doesn't work, then close study of the nesc doc is indicated.
> 
> MS
> 
> 
> Mark Tsang wrote:
>> But NoCRCPacket doesn't have an interface.  It looks to be a standalone
>> module.  Or am I missing something?
>>
>> -----Original Message-----
>> From: Michael Schippling [mailto:[EMAIL PROTECTED] 
>> Sent: Monday, March 17, 2008 5:43 PM
>> To: Mark Tsang
>> Cc: tinyos-help@millennium.berkeley.edu
>> Subject: Re: [Tinyos-help] Utilizing a command from another module,
>>
>> look for documentation on NESC. Basically anything in the interface
>> for a module can be "call"ed from another module.
>> MS
>>
>> Mark Tsang wrote:
>>> I was wondering how I would go about calling a command from another 
>>> module to utilize in my own module.  For instance, I want to use the 
>>> command "txBytes" in NoCRCPacket in my own program MyApp.  What do I 
>>> have to add in my program to do so.  I've read in other threads that I 
>>> need to wire NoCRCPacket to UART and I have done so, but I'm still 
>>> receiving the following error message during compilation:  NOTE:  I'm 
>>> calling txBytes in my Timer.fired command below in the module
>>>
>>>  
>>>
>>> In component `NoCRCPacket':
>>>
>>> /opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc: In function
>> `receiveTask':
>>> /opt/MoteWorks/tos/platform/micaz/NoCRCPacket.nc:306: Receive.receive 
>>> not connected
>>>
>>>  
>>>
>>>  
>>>
>>> The error message isn't pointing to my program, instead the platform 
>>> file.  What am I doing wrong.  Thanks in advance!
>>>
>>>  
>>>
>>> configuration MyApp {
>>>
>>>   provides {
>>>
>>>                 command result_t txBytes(uint8_t *bytes, uint8_t
>> numBytes);
>>>   }
>>>
>>> }
>>>
>>> implementation {
>>>
>>>   components Main, MyAppM, TimerC, LedsC, NoCRCPacket as NoPacket, UART;
>>>
>>>  
>>>
>>>   Main.StdControl -> TimerC.StdControl;
>>>
>>>   Main.StdControl -> MyAppM.StdControl;
>>>
>>>   Main.StdControl -> NoPacket.Control;
>>>
>>>  
>>>
>>>   MyAppM.Timer -> TimerC.Timer[unique("Timer")];
>>>
>>>   MyAppM.Leds -> LedsC.Leds;
>>>
>>>  
>>>
>>>   txBytes = NoPacket.txBytes;
>>>
>>>  
>>>
>>>   NoPacket.ByteControl -> UART;
>>>
>>>   NoPacket.ByteComm -> UART;
>>>
>>>  
>>>
>>> }
>>>
>>>  
>>>
>>> module MyAppM {
>>>
>>>   provides {
>>>
>>>     interface StdControl;
>>>
>>>                
>>>
>>>   }
>>>
>>>   uses {
>>>
>>>     interface Timer;
>>>
>>>     interface Leds;
>>>
>>>                 interface StdControl as PhotoControl;
>>>
>>>                 interface SendUART;
>>>
>>>                
>>>
>>>                 command result_t txBytes(uint8_t *bytes, uint8_t
>> numBytes);
>>>   }
>>>
>>> }
>>>
>>> implementation {
>>>
>>>  
>>>
>>>   /**
>>>
>>>    * Toggle the red LED in response to the <code>Timer.fired</code>
> event.
>>>    * Start the Light sensor control and sample the data
>>>
>>>    *
>>>
>>>    * @return Always returns <code>SUCCESS</code>
>>>
>>>    **/
>>>
>>>   event result_t Timer.fired()
>>>
>>>   {
>>>
>>>     call Leds.redToggle();   
>>>
>>>                 // send message to UART (serial) port
>>>
>>>                 if (call txBytes((uint8_t *)0x41,(uint8_t *)0x01) != 
>>> SUCCESS)
>>>
>>>                   sending_packet = FALSE;
>>>
>>>                  
>>>
>>>     return SUCCESS;
>>>
>>>   }
>>>
>>>  
>>>
>>>   command result_t StdControl.init() {
>>>
>>>     call Leds.init();
>>>
>>>     }
>>>
>>>  
>>>
>>>   command result_t StdControl.start() {
>>>
>>>     // Start a repeating timer that fires every 1000ms
>>>
>>>     return call Timer.start(TIMER_REPEAT, 1000);
>>>
>>>   }
>>>
>>>  
>>>
>>>   /**
>>>
>>>    * Halt execution of the application.
>>>
>>>    * This just disables the clock component.
>>>
>>>    *
>>>
>>>    * @return Always returns <code>SUCCESS</code>
>>>
>>>    **/
>>>
>>>   command result_t StdControl.stop() {
>>>
>>>     return call Timer.stop();
>>>
>>>   }
>>>
>>>  
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> Tinyos-help@millennium.berkeley.edu
>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

-- 
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew


_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to