/****************************************************************************
 *
 * NAME: vTxSerialDataFrame
 *
 * DESCRIPTION:
 * Transmits node data (address and sensor readings) to host via serial port.
 *
 * PARAMETERS: Name           RW  Usage
 *             u16NodeId      R   Short address of node that generated the data
 *             u16Humidity    R   Reading from humidity sensor (%)
 *             u16Temperature R   Reading from temperature sensor (degrees C)
 *             u16BattVoltage R   ADC reading of supply voltage (mv)
 *
 ****************************************************************************/
PRIVATE void vTxSerialDataFrame(uint16 count,
                                uint16 u16Humidity,
                                uint16 u16Temperature,
                                uint32 sensorMach,
                                uint32 sensorMacl)
{
    #ifndef GDB
        vPrintf("\n\rS%d,", count);
        vPrintf("\n\rH%d,", u16Humidity);
        vPrintf("\n\rT%d,", u16Temperature);
        vPrintf("\n\rMac:%x %x,", sensorMach, sensorMacl);
	#endif
}
Ejemplo n.º 2
0
static	int	displayValues(object dlg, int res)
{
	char	*val;
	object	wind;
	
	if (res == TRUE)  {
		wind = gGetTag(dlg);
		val = mCtlStringValue(dlg, FIELD_FIRST_NAME);
		vPrintf(wind, "First Name = %s\n", val);

		val = mCtlStringValue(dlg, FIELD_LAST_NAME);
		vPrintf(wind, "Last Name = %s\n\n", val);
	}
	return res;
}
Ejemplo n.º 3
0
static	void	report_output(object pntr)
{
	if (!gTextOut(pntr, 0, 0, "Line 0"))
		return;
	if (!gTextOut(pntr, 1, 0, "Line 1"))
		return;
	if (!gTextOut(pntr, 2, 0, "Line 2"))
		return;
	if (!gTextOut(pntr, 64, 40, "Line 64"))
		return;
	if (!gTextOut(pntr, 66, 40, "Line 66"))
		return;
	if (!gTextOut(pntr, 65, 40, "Line 65"))
		return;
	if (-1 == gPuts(pntr, "\n\n\n\n\n\nThis is a gPuts line of output.\n"))
		return;
	if (-1 == vPrintf(pntr, "\nColby is %d years old.\n", 8))
		return;

	if (!gNewPage(pntr))
		return;

	if (!gTextOut(pntr, 33, 40, "Second Page of Output!"))
		return;
}
Ejemplo n.º 4
0
/****************************************************************************
 *
 * NAME: vJenie_CbInit
 *
 * DESCRIPTION:
 * Initialisation of system.
 *
 * RETURNS:
 * Nothing
 *
 ****************************************************************************/
PUBLIC void vJenie_CbInit(bool_t bWarmStart)
{
	teJenieStatusCode eStatus; /* Jenie status code */

	/* Warm start - reopen UART for printf use {v2} */
	if (bWarmStart) vUART_printInit();
	/* Output function call to UART */
	vPrintf("vJenie_CbInit(%d)\n", bWarmStart);

    /* Initialise application */
    vApp_CbInit(bWarmStart);

	/* Start Jenie */
    eStatus = eJenie_Start(E_JENIE_COORDINATOR);
	/* Output function call to UART {v2} */
	vPrintf("eJenie_Start(COORDINATOR) = %d\n", eStatus);
}
Ejemplo n.º 5
0
void CommDev::Printf( const char *fmt, ... )
{
    va_list args;

    va_start( args, fmt );
    vPrintf( fmt, args );
    va_end( args );
    
} // Printf
Ejemplo n.º 6
0
void Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt, ...) {
  String *out;
  char *msg;
  int wrn = 1;
  va_list ap;
  if (silence)
    return;
  if (!init_fmt)
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);

  va_start(ap, fmt);

  out = NewStringEmpty();
  vPrintf(out, fmt, ap);

  msg = Char(out);
  if (isdigit((unsigned char) *msg)) {
    unsigned long result = strtoul(msg, &msg, 10);
    if (msg != Char(out)) {
      msg++;
      wnum = result;
    }
  }

  /* Check in the warning filter */
  if (filter) {
    char temp[32];
    char *c;
    char *f = Char(filter);
    sprintf(temp, "%d", wnum);
    while (*f != '\0' && (c = strstr(f, temp))) {
      if (*(c - 1) == '-') {
	wrn = 0;		/* Warning disabled */
        break;
      }
      if (*(c - 1) == '+') {
	wrn = 1;		/* Warning enabled */
        break;
      }
      f += strlen(temp);
    }
  }
  if (warnall || wrn) {
    String *formatted_filename = format_filename(filename);
    if (wnum) {
      Printf(stderr, wrn_wnum_fmt, formatted_filename, line, wnum);
    } else {
      Printf(stderr, wrn_nnum_fmt, formatted_filename, line);
    }
    Printf(stderr, "%s", msg);
    nwarning++;
    Delete(formatted_filename);
  }
  Delete(out);
  va_end(ap);
}
Ejemplo n.º 7
0
CPLString &CPLString::Printf( const char *pszFormat, ... )

{
    va_list args;

    va_start( args, pszFormat );
    vPrintf( pszFormat, args );
    va_end( args );

    return *this;
}
Ejemplo n.º 8
0
static void process_file(object list, char *file) 
{ 
	char buf[256], *p; 
	object fobj; 

	fobj = gOpenFile(File, file, "r"); 
	if (!fobj) { 
		vPrintf(stdoutStream, "Can't open %s\n", file); 
		exit(1); 
	} 
	while (gGets(fobj, buf, sizeof buf)) 
		for (p=buf ; *(p=process_token(p, list)) ; ); 
	gDispose(fobj); 
} 
Ejemplo n.º 9
0
/****************************************************************************
 *
 * NAME: vJenie_CbConfigureNetwork
 *
 * DESCRIPTION:
 * Entry point for application from boot loader.
 *
 * RETURNS:
 * Nothing
 *
 ****************************************************************************/
PUBLIC void vJenie_CbConfigureNetwork(void)
{
	/* Set up routing table */
	gJenie_RoutingEnabled    = TRUE;
	gJenie_RoutingTableSize  = ROUTING_TABLE_SIZE;
	gJenie_RoutingTableSpace = (void *) asRoutingTable;

    /* Change default network config */
    gJenie_NetworkApplicationID = APPLICATION_ID;
    gJenie_PanID                = PAN_ID;
    gJenie_Channel              = CHANNEL;
    gJenie_ScanChannels         = SCAN_CHANNELS;

	/* Open UART for printf use {v2} */
	vUART_printInit();
	/* Output function call to UART */
	vPrintf("\nvJenie_CbConfigureNetwork()\n");
}
Ejemplo n.º 10
0
void Swig_diagnostic(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
  va_list ap;
  String *formatted_filename = NULL;

  if (!init_fmt)
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);

  va_start(ap, fmt);
  formatted_filename = format_filename(filename);
  if (line > 0) {
    Printf(stdout, diag_line_fmt, formatted_filename, line);
  } else {
    Printf(stdout, diag_eof_fmt, formatted_filename);
  }
  vPrintf(stdout, fmt, ap);
  va_end(ap);
  Delete(formatted_filename);
}
Ejemplo n.º 11
0
void Swig_error(const String_or_char *filename, int line, const char *fmt, ...) {
  va_list ap;
  String *formatted_filename = NULL;

  if (silence)
    return;
  if (!init_fmt)
    Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);

  va_start(ap, fmt);
  formatted_filename = format_filename(filename);
  if (line > 0) {
    Printf(stderr, err_line_fmt, formatted_filename, line);
  } else {
    Printf(stderr, err_eof_fmt, formatted_filename);
  }
  vPrintf(stderr, fmt, ap);
  va_end(ap);
  nerrors++;
  Delete(formatted_filename);
}
Ejemplo n.º 12
0
void 
Swig_error(const String_or_char *filename, int line, const char *fmt, ...) {
  va_list ap;

  if (silence) return;

  va_start(ap,fmt);
  if (line > 0) {
    switch (msg_format) {
      case EMF_MICROSOFT:
        Printf(stderr,"%s(%d): ", filename, line);
        break;
      case EMF_STANDARD:
      default:
        Printf(stderr,"%s:%d: ", filename, line);
        break;
    }
  } else {
    Printf(stderr,"%s:EOF: ", filename);
  }
  vPrintf(stderr,fmt,ap);
  va_end(ap);
  nerrors++;
}
/****************************************************************************
 *
 * NAME: JZA_pu8AfMsgObject
 *
 * DESCRIPTION:
 * Called when a MSG transaction has been received with a matching endpoint.
 *
 * PARAMETERS:      Name           RW  Usage
 *                  afSrcAddr      R   Address of sender device
 *                  dstEndPoint    R   Endpoint at receiver
 *                  clusterID      R   Pointer to cluster ID
 *                  afduLength     R   Pointer to length of data
 *                  pAfdu          R   Data array
 *
 * RETURNS:
 * NULL
 *
 ****************************************************************************/
PUBLIC bool_t JZA_bAfMsgObject(APS_Addrmode_e eAddrMode,
                               uint16 u16AddrSrc,
                               uint8 u8SrcEP,
                               uint8 u8LQI,
                               uint8 u8DstEP,
                               uint8 u8ClusterID,
                               uint8 *pu8ClusterIDRsp,
                               AF_Transaction_s *puTransactionInd,
                               AF_Transaction_s *puTransactionRsp)
{
	uint16 u16Humidity;
	uint16 u16BattVoltage;
	uint16 u16Temperature;
	uint32 mach, macl;
	static uint16 count, count1 = 0, count_s = 0;
	MAC_ExtAddr_s sExtAddr, *psExtAddr;
	uint16 command;
	int i;

    if ((eAddrMode == APS_ADDRMODE_SHORT) && (u8DstEP == WSN_DATA_SINK_ENDPOINT))
    {
        if(u8ClusterID == WSN_CID_SENSOR_READINGS)
        {
            command = puTransactionInd[0].uFrame.sMsg.au8TransactionData[0];
            if(command == CONTROL_CMD_GET_INFO)
            {
                //vPrintf("CONTROL_CMD_GET_INFO\n");
                count1++;
                vPrintf("count1: %dx\n", count1);
                if(count1 > 10 || getinfo_ok)
                {
                    vPrintf("get info okx\n");
                    getinfo_ok = TRUE;
                    count1 = 0;
                    return;
                }
                sensordata.datatype = WAITING_MODE;
                for(i = 0; i < 10; i++)
                {
                    if(sensordata.sensorinfo[i].sensorID == u16AddrSrc)
                        break;
                    sensordata.sensorinfo[i].sensorID = u16AddrSrc;
                    sensordata.sensorinfo[i].isValiable = TRUE;
                    sensordata.sensorinfo[i].mach = (puTransactionInd[0].uFrame.sMsg.au8TransactionData[1] & 0xff);
                    sensordata.sensorinfo[i].mach = sensordata.sensorinfo[i].mach << 24;
                    sensordata.sensorinfo[i].mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[2] << 16) & 0xffff0000);
                    sensordata.sensorinfo[i].mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[3] << 8) & 0xffffff00);
                    sensordata.sensorinfo[i].mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[4]) & 0xffffffff);

                    sensordata.sensorinfo[i].macl = (puTransactionInd[0].uFrame.sMsg.au8TransactionData[5] & 0xff);
                    sensordata.sensorinfo[i].macl = sensordata.sensorinfo[i].macl << 24;
                    sensordata.sensorinfo[i].macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[6] << 16) & 0xffff0000);
                    sensordata.sensorinfo[i].macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[7] << 8) & 0xffffff00);
                    sensordata.sensorinfo[i].macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[8]) & 0xffffffff);
                    break;
                }
            }
            else if(command == CONTROL_CMD_GET_DATA_S)
            {
                sensordata.datatype = SINGLE_MODE;
                //vPrintf("CONTROL_CMD_GET_DATA_S");
                if(count_s == 6)
                    count_s = 0;
                sensordata.datatype = SINGLE_MODE;
                sensordata.data.sd.sensorID = u16AddrSrc;
                sensordata.data.sd.tempdata[count_s] = puTransactionInd[0].uFrame.sMsg.au8TransactionData[4];
                sensordata.data.sd.tempdata[count_s] = sensordata.data.sd.tempdata[count_s]<<8;
                sensordata.data.sd.tempdata[count_s] |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[3];
                if(sensordata.data.sd.tempdata[count_s] > 99)
                    sensordata.data.sd.templength[count_s] = 3;
                else if(sensordata.data.sd.tempdata[count_s] <10)
                    sensordata.data.sd.templength[count_s] = 1;
                else
                    sensordata.data.sd.templength[count_s] = 2;

                sensordata.data.sd.humidata[count_s] = puTransactionInd[0].uFrame.sMsg.au8TransactionData[6];
                sensordata.data.sd.humidata[count_s] = sensordata.data.sd.humidata[count_s]<<8;
                sensordata.data.sd.humidata[count_s] |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[5];
                if(sensordata.data.sd.humidata[count_s] > 99)
                    sensordata.data.sd.humilength[count_s] = 3;
                else if(sensordata.data.sd.humidata[count_s] <10)
                    sensordata.data.sd.humilength[count_s] = 1;
                else
                    sensordata.data.sd.humilength[count_s] = 2;

                count_s++;
            }
            else if(command == CONTROL_CMD_GET_DATA_M)
            {
                //vPrintf("CONTROL_CMD_GET_DATA_M");
                sensordata.datatype = MULTI_MODE;
                for(i = 0; i < 6; i++)
                {
                    if(u16AddrSrc == sensordata.sensorinfo[i].sensorID)
                    {
                        sensordata.data.md[i].sensorID = u16AddrSrc;
                        sensordata.data.md[i].isValiable = TRUE;
                        sensordata.data.md[i].tempdata = puTransactionInd[0].uFrame.sMsg.au8TransactionData[4];
                        sensordata.data.md[i].tempdata = sensordata.data.md[i].tempdata<<8;
                        sensordata.data.md[i].tempdata |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[3];
                        if(sensordata.data.md[i].tempdata > 99)
                            sensordata.data.md[i].templength = 3;
                        else if(sensordata.data.md[i].tempdata <10)
                            sensordata.data.md[i].templength = 1;
                        else
                            sensordata.data.md[i].templength = 2;

                        sensordata.data.md[i].humidata = puTransactionInd[0].uFrame.sMsg.au8TransactionData[6];
                        sensordata.data.md[i].humidata = sensordata.data.md[i].tempdata<<8;
                        sensordata.data.md[i].humidata |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[5];
                        if(sensordata.data.md[i].humidata > 99)
                            sensordata.data.md[i].humilength = 3;
                        else if(sensordata.data.md[i].humidata <10)
                            sensordata.data.md[i].humilength = 1;
                        else
                            sensordata.data.md[i].humilength = 2;
                    }
                }
            }
            /*count++;
            u16BattVoltage  = puTransactionInd[0].uFrame.sMsg.au8TransactionData[2];
            u16BattVoltage  = u16BattVoltage << 8;
            u16BattVoltage |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[1];

            u16Temperature  = puTransactionInd[0].uFrame.sMsg.au8TransactionData[4];
            u16Temperature  = u16Temperature << 8;
            u16Temperature |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[3];

            u16Humidity  = puTransactionInd[0].uFrame.sMsg.au8TransactionData[6];
            u16Humidity  = u16Humidity << 8;
            u16Humidity |= puTransactionInd[0].uFrame.sMsg.au8TransactionData[5];

            for(i = 6; i < 14; i++)
                vPrintf("%x ", puTransactionInd[0].uFrame.sMsg.au8TransactionData[i]);
            mach = (puTransactionInd[0].uFrame.sMsg.au8TransactionData[7] & 0xff);
            mach = mach << 24;
            mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[8] << 16) & 0xffff0000);
            mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[9] << 8) & 0xffffff00);
            mach |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[10]) & 0xffffffff);

            macl = (puTransactionInd[0].uFrame.sMsg.au8TransactionData[11] & 0xff);
            macl = macl << 24;
            macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[12] << 16) & 0xffff0000);
            macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[13] << 8) & 0xffffff00);
            macl |= ((puTransactionInd[0].uFrame.sMsg.au8TransactionData[14]) & 0xffffffff);

            sExtAddr.u32L = macl;
            sExtAddr.u32H = mach;

            if(count > 10)
            {
                count = 0;
                JZS_vRemoveNode(&sExtAddr, TRUE);
                //bNwkRemoveDevice(u16AddrSrc);
                vPrintf("remove success!\n");
            }
            vPrintf("%d\n", puTransactionInd[0].uFrame.sMsg.au8TransactionData[0]);//
            vPrintf("%d\n", puTransactionInd[1].uFrame.sMsg.au8TransactionData[0]);
            vTxSerialDataFrame(count, u16Humidity, u16Temperature, mach, macl);*/
        }
    }
    return 0;
}
/****************************************************************************
 *
 * NAME: vToggleLed
 *
 * DESCRIPTION:
 * Gets called by a BOS timer. Toggles LED1 to indicate we are alive.
 *
 ****************************************************************************/
PRIVATE void vToggleLed(void *pvMsg, uint8 u8Dummy)
{
    uint8 u8Msg;
    uint8 u8TimerId;
    static int count = 3;
    static bool_t bToggle;
    static int fillcount = 0;
    MAC_ExtAddr_s sExtAddr, *psExtAddr;

    int i;
    AF_Transaction_s asTransaction[1];


    asTransaction[0].u8SequenceNum = u8AfGetTransactionSequence(TRUE);
    asTransaction[0].uFrame.sMsg.u8TransactionDataLen = 1;

    asTransaction[0].uFrame.sMsg.au8TransactionData[0] = 9;
    //static int sensorID[3] = {0, };

    vReadTempHumidity();

    if (bToggle)
    {
        vLedControl(0,0);
    }
    else
    {
        vLedControl(0,1);
    }
    bToggle = !bToggle;
    /* if(afdeDataRequest(APS_ADDRMODE_SHORT,
                          0x0001,
                          WSN_DATA_SOURCE_ENDPOINT,
                          WSN_DATA_SINK_ENDPOINT,
                          WSN_PROFILE_ID,
                          WSN_CID_SENSOR_READINGS,
                          AF_MSG,
                          1,
                          asTransaction,
                          APS_TXOPTION_NONE,
                          SUPPRESS_ROUTE_DISCOVERY,
                          0)){;}
        armCmd = single;*/
    if(commandChanged == TRUE)
    {
        //vPrintf("command changed!\n");
        commandChanged = FALSE;
        switch(armCmd)
        {
            case reflash:
                //vPrintf("reflashed\n");
                sensordata.datatype = WAITING_MODE;
                for(i = 0; i < 6; i++)
                {
                    if(sensordata.sensorinfo[i].isValiable == TRUE)
                    {
                        asTransaction[0].uFrame.sMsg.au8TransactionData[0] = WAITING_MODE;
                        afdeDataRequest(APS_ADDRMODE_SHORT,
                            sensordata.sensorinfo[i].sensorID,
                            WSN_DATA_SOURCE_ENDPOINT,
                            WSN_DATA_SINK_ENDPOINT,
                            WSN_PROFILE_ID,
                            WSN_CID_SENSOR_READINGS,
                            AF_MSG,
                            1,
                            asTransaction,
                            APS_TXOPTION_NONE,
                            SUPPRESS_ROUTE_DISCOVERY,
                            0);
                    }
                }
                break;
            case single:
                //vPrintf("single mode send\n");
                sensordata.sensorID = 0x0001;
                for(i = 0; i < 6; i++)
                {
                    if(sensordata.sensorID != sensordata.sensorinfo[i].sensorID)
                    {
                        if(sensordata.sensorinfo[i].isValiable == TRUE)
                        {
                            sExtAddr.u32L = sensordata.sensorinfo[i].macl;
                            sExtAddr.u32H = sensordata.sensorinfo[i].mach;

                            JZS_vRemoveNode(&sExtAddr, TRUE);
                            //bNwkRemoveDevice(u16AddrSrc);
                            vPrintf("sensor: %d remove success!x\n", sensordata.sensorinfo[i].sensorID);
                            sensordata.sensorinfo[i].isValiable = FALSE;
                        }
                    }
                }
                asTransaction[0].uFrame.sMsg.au8TransactionData[0] = CONTROL_CMD_GET_DATA_S;
                afdeDataRequest(APS_ADDRMODE_SHORT,
                        sensordata.sensorID,
                        WSN_DATA_SOURCE_ENDPOINT,
                        WSN_DATA_SINK_ENDPOINT,
                        WSN_PROFILE_ID,
                        WSN_CID_SENSOR_READINGS,
                        AF_MSG,
                        1,
                        asTransaction,
                        APS_TXOPTION_NONE,
                        SUPPRESS_ROUTE_DISCOVERY,
                        0);
                /*singledata.estate.num++;
                if(singledata.estate.num > 5)
                {
                    singledata.estate.num = 0;
                    singledata.estate.estate = E_FILL_COMPLETE;
                }else
                    singledata.estate.estate = E_FILL_UNCOMPLETE;
                singledata.tempdata[singledata.estate.num] = sTempHumiditySensor.u16TempReading;
                singledata.humidata[singledata.estate.num] = sTempHumiditySensor.u16HumidReading;
                if(singledata.tempdata[singledata.estate.num] > 100)
                {
                    singledata.tempdata[singledata.estate.num] = 100;
                    singledata.templength[singledata.estate.num] = 3;
                }else if(singledata.tempdata[singledata.estate.num] <= 0)
                {
                    singledata.tempdata[singledata.estate.num] = 0;
                    singledata.templength[singledata.estate.num] = 1;
                }else
                {
                    singledata.templength[singledata.estate.num] = 2;
                }

                if(singledata.humidata[singledata.estate.num] > 100)
                {
                    singledata.humidata[singledata.estate.num] = 100;
                    singledata.humilength[singledata.estate.num] = 3;
                }else if(singledata.humidata[singledata.estate.num] <= 0)
                {
                    singledata.humidata[singledata.estate.num] = 0;
                    singledata.humilength[singledata.estate.num] = 1;
                }else
                {
                    singledata.humilength[singledata.estate.num] = 2;
                }

                if(singledata.estate.estate == E_FILL_COMPLETE)
                    vPrintf("S%d,T[%d]%d:%d,H[%d]%d:%d,T[%d]%d:%d,H[%d]%d:%d,T[%d]%d:%d,H[%d]%d:%d,T[%d]%d:%d,H[%d]%d:%d,T[%d]%d:%d,H[%d]%d:%d,T[%d]%d:%d,H[%d]%d:%d\n",
                                singledata.sensorID, 0, singledata.templength[0], singledata.tempdata[0], 0, singledata.humilength[0], singledata.humidata[0],
                                1, singledata.templength[1], singledata.tempdata[1], 1, singledata.humilength[1], singledata.humidata[1],
                                2, singledata.templength[2], singledata.tempdata[2], 2, singledata.humilength[2], singledata.humidata[2],
                                3, singledata.templength[3], singledata.tempdata[3], 3, singledata.humilength[3], singledata.humidata[3],
                                4, singledata.templength[4], singledata.tempdata[4], 4, singledata.humilength[4], singledata.humidata[4],
                                5, singledata.templength[5], singledata.tempdata[5], 5, singledata.humilength[5], singledata.humidata[5]);
                    //vTxSerialDataFrame(1, sTempHumiditySensor.u16HumidReading,sTempHumiditySensor.u16TempReading);
                sTempHumiditySensor.eState = E_STATE_READ_TEMP_HUMID_IDLE;*/
                break;
            case mulit:
                for(i = 0; i < 6; i++)
                {
                    asTransaction[0].uFrame.sMsg.au8TransactionData[0] = CONTROL_CMD_GET_DATA_M;
                    if(sensordata.sensorinfo[i].isValiable == TRUE)
                        afdeDataRequest(APS_ADDRMODE_SHORT,
                        sensordata.sensorinfo[i].sensorID,
                        WSN_DATA_SOURCE_ENDPOINT,
                        WSN_DATA_SINK_ENDPOINT,
                        WSN_PROFILE_ID,
                        WSN_CID_SENSOR_READINGS,
                        AF_MSG,
                        1,
                        asTransaction,
                        APS_TXOPTION_NONE,
                        SUPPRESS_ROUTE_DISCOVERY,
                        0);
                    /*if(multidata[i].available == NOT_NULL)
                    {
                        multidata[i].tempdata = sTempHumiditySensor.u16TempReading;
                        multidata[i].humidata = sTempHumiditySensor.u16HumidReading;
                        vPrintf("S:%d,T:%d,H:%d\n",
                                multidata[i].sensorID, multidata[i].tempdata, multidata[i].humidata);
                    }*/
                }
                //sTempHumiditySensor.eState = E_STATE_READ_TEMP_HUMID_IDLE;
                break;
            case stop:
                //vPrintf("stopped!\n");
                break;
            default:
                    //vPrintf("wait for start!\n");
                break;
        }
    }
    if(sensordata.datatype == WAITING_MODE)
    {
        for(i = 0; i < 6; i++)
        {
            if(sensordata.sensorinfo[i].isValiable == TRUE)
                vPrintf("%d is avaliable x\n", sensordata.sensorinfo[i].sensorID);
        }
    }
    else if(sensordata.datatype == SINGLE_MODE)
    {
        if(fillcount == 6)
            fillcount = 0;

        vPrintf("S%dT%dL%d%dH%dL%d%dx\n", sensordata.data.sd.sensorID,
                                         fillcount, sensordata.data.sd.templength[fillcount], sensordata.data.sd.tempdata[fillcount],
                                         fillcount, sensordata.data.sd.humilength[fillcount], sensordata.data.sd.humidata[fillcount]);
        fillcount++;
    }
    else if(sensordata.datatype == MULTI_MODE)
    {
        for(i = 0; i < 6; i++)
        {
            if(sensordata.data.md[i].isValiable == TRUE)
                vPrintf("S%dT%dL%d%dH%dL%d%dx\n", sensordata.data.md[i].sensorID,
                                                 i, sensordata.data.md[i].templength, sensordata.data.md[i].tempdata,
                                                 i, sensordata.data.md[i].humilength, sensordata.data.md[i].humidata);
        }
    }
    else if(sensordata.datatype == UNSTARTED)
    {
        //vPrintf("wait for start\n");
    }

    (void)bBosCreateTimer(vToggleLed, &u8Msg, 0, (APP_TICK_PERIOD_ms / 10), &u8TimerId);
}
Ejemplo n.º 15
0
void 
Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt, ...) {
  String *out;
  char   *msg;
  int     wrn = 1;
  va_list ap;
  if (silence) return;
  
  va_start(ap,fmt);

  out = NewString("");
  vPrintf(out,fmt,ap);
  {
    char temp[64], *t;
    t = temp;
    msg = Char(out);
    while (isdigit((int) *msg)) {
      *(t++) = *(msg++);
    }
    if (t != temp) {
      msg++;
      *t = 0;
      wnum = atoi(temp);
    }
  }

  /* Check in the warning filter */
  if (filter) {
    char    temp[32];    
    char *c;
    sprintf(temp,"%d",wnum);
    c = Strstr(filter,temp);
    if (c) {
      if (*(c-1) == '-') wrn = 0;     /* Warning disabled */
      if (*(c-1) == '+') wrn = 1;     /* Warning enabled */
    }
  }
  if (warnall || wrn) {
    if (wnum) {
      switch (msg_format) {
        case EMF_MICROSOFT:
          Printf(stderr,"%s(%d): Warning(%d): ", filename, line, wnum);
          break;
        case EMF_STANDARD:
        default:
          Printf(stderr,"%s:%d: Warning(%d): ", filename, line, wnum);
          break;
      }
    } else {
      switch (msg_format) {
        case EMF_MICROSOFT:
          Printf(stderr,"%s(%d): Warning: ", filename, line);
          break;
        case EMF_STANDARD:
        default:
          Printf(stderr,"%s:%d: Warning: ", filename, line);
          break;
      }
    }
    Printf(stderr,"%s",msg);
    nwarning++;
  }
  Delete(out);
  va_end(ap);
}