| Author |
Message |
|
|
Posted: Mar 11, 2012 - 10:50 PM |
|


Joined: Apr 15, 2009
Posts: 4857
Location: San Jose, CA
|
|
|
bt0618 wrote:
How do I check APS_DataConf(), should I output it onto WSNMonitor and observe its output?
However you like. Use debugger if you have one, blink an LED, etc.
bt0618 wrote:
The code is a bit lengthy so I uploaded it onto mediafire:
You need to fill asduLength and APS_DataConf fields. |
|
|
| |
|
|
|
|
|
Posted: Mar 12, 2012 - 02:03 AM |
|

Joined: Feb 02, 2012
Posts: 25
|
|
So I added:
Code:
messageParams.asduLength = sizeof(outgoingMessage.data);
messageParams.asdu = (uint8_t *)(&outgoingMessage.data);
into my code.
When I tried to do:
Code:
messageParams.APS_DataConf = APS_DataConf();
I get an error saying
Code:
C:\Users\...\Applications\WSNDemo\makefiles\STK600/../../src/WSNCoord.c:95: undefined reference to `APS_DataConf'
in the build console
Am I suppose to declare
Code:
static void APS_DataConf(APS_DataConf_t *confInfo);
at the top of "WSNCoord.c"? |
|
|
| |
|
|
|
|
|
Posted: Mar 12, 2012 - 02:07 AM |
|


Joined: Apr 15, 2009
Posts: 4857
Location: San Jose, CA
|
|
|
bt0618 wrote:
When I tried to do:
Code:
messageParams.APS_DataConf = APS_DataConf();
Code:
messageParams.APS_DataConf = APS_DataConf;
And yes, you need to have this function declared. |
|
|
| |
|
|
|
|
|
Posted: Mar 12, 2012 - 03:02 AM |
|

Joined: Feb 02, 2012
Posts: 25
|
|
Sorry alexru but I still get the same error
Here is my current "WSNCoord.c" code:
Code:
#ifdef _COORDINATOR_
#include <WSNDemoApp.h>
#include <WSNVisualizer.h>
extern AppMessageRequest_t appMessage;
extern APS_DataReq_t messageParams;
extern HAL_AppTimer_t deviceTimer;
extern bool subTaskRequested;
static void APS_DataConf(APS_DataConf_t *confInfo);
static void deviceTimerFired(void);
static void appSensorsesGot(void);
void appInitDeviceCoordinator(void);
// global variables
AppMessageRequest_t outgoingMessage;
void appCoordinatorTaskHandler(AppEvent_t event, void *param)
{
param = param; // warning prevention
switch (appDeviceState)
{
case READING_SENSORS_STATE:
switch (event)
{
case APP_PROCESS:
appReadLqiRssi();
appStartSensorManager();
appGetSensorData(appSensorsesGot);
break;
case APP_READING_DONE:
appDeviceState = SENDING_DEVICE_STATE;
appStopSensorManager();
appPostSubTaskTask();
break;
default:
break;
}
break;
case SENDING_DEVICE_STATE:
switch (event)
{
case APP_PROCESS:
visualizeSerialTx();
appSendMessageToUsart(&appMessage.data, sizeof(AppMessage_t));
/***********/
messageParams.profileId = simpleDescriptor.AppProfileId;
messageParams.dstAddrMode = APS_SHORT_ADDRESS;
messageParams.dstAddress.shortAddress = 0xFFFF;
messageParams.dstEndpoint = 1;
messageParams.clusterId = CPU_TO_LE16(1);
messageParams.srcEndpoint = simpleDescriptor.endpoint;
messageParams.asduLength = sizeof(outgoingMessage.data);
messageParams.asdu = (uint8_t *)(&outgoingMessage.data);
messageParams.txOptions.acknowledgedTransmission = 0;
#ifdef _APS_FRAGMENTATION_
messageParams.txOptions.fragmentationPermitted = 1;
#endif
#ifdef _HIGH_SECURITY_
messageParams.txOptions.securityEnabledTransmission = 1;
#endif
messageParams.radius = 0x0;
messageParams.APS_DataConf = APS_DataConf;
/***********/
outgoingMessage.data.message[0] = 0xFF; // 1st byte
outgoingMessage.data.message[1] = 0xFF; // 2nd byte
APS_DataReq(&messageParams);
/***********/
appDeviceState = STARTING_TIMER_STATE;
appPostSubTaskTask();
break;
default:
break;
}
break;
case STARTING_TIMER_STATE:
switch (event)
{
case APP_PROCESS:
HAL_StartAppTimer(&deviceTimer);
break;
case APP_TIMER_FIRED:
appDeviceState = READING_SENSORS_STATE;
appPostSubTaskTask();
break;
default:
break;
}
break;
case WAITING_DEVICE_STATE:
switch (event)
{
default:
appDeviceState = INITIAL_DEVICE_STATE;
appPostSubTaskTask();
break;
}
break;
case INITIAL_DEVICE_STATE:
switch (event)
{
case APP_PROCESS:
HAL_StopAppTimer(&deviceTimer);
deviceTimer.interval = APP_TIMER_SENDING_PERIOD;
deviceTimer.mode = TIMER_ONE_SHOT_MODE;
deviceTimer.callback = deviceTimerFired;
appDeviceState = READING_SENSORS_STATE;
appPostSubTaskTask();
break;
default:
break;
}
break;
default:
break;
}
}
void appInitDeviceCoordinator(void)
{
appDeviceState = INITIAL_DEVICE_STATE;
appPostSubTaskTask();
}
static void appSensorsesGot(void)
{
appCoordinatorTaskHandler(APP_READING_DONE, NULL);
}
static void deviceTimerFired(void)
{
appCoordinatorTaskHandler(APP_TIMER_FIRED, NULL);
}
void APS_DataIndCoord(APS_DataInd_t *indData)
{
visualizeAirRxFinished();
appSendMessageToUsart(indData->asdu, indData->asduLength);
}
#endif
|
|
|
| |
|
|
|
|
|
Posted: Mar 12, 2012 - 03:29 AM |
|


Joined: Apr 15, 2009
Posts: 4857
Location: San Jose, CA
|
|
You really need to read some book about C programming language.
You've defined a prototype, you also need to define function body:
Code:
static void APS_DataConf(APS_DataConf_t *confInfo)
{
//
}
|
_________________ The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I’m affiliated with.
|
| |
|
|
|
|
|
Posted: Mar 12, 2012 - 05:41 AM |
|

Joined: Feb 02, 2012
Posts: 25
|
|
I admit that I do need to sharpen up my programming skills. I usually work in a pre-built code environment and only do basic C coding.
I do sincerely apologize and thank you for all your help so far.
The good news is that everything works now.
The router reacts exactly how I expected it to.
Once again, thank you for all your help. |
|
|
| |
|
|
|
|
|