예제 #1
0
/* Callback function that check the read SDO demand */
void CheckReadInfoSDO(CO_Data* d, UNS8 nodeid)
{
	UNS32 abortCode;
	UNS32 data=0;
	UNS32 size=64;

	if(getReadResultNetworkDict(CANOpenShellOD_Data, nodeid, &data, &size, &abortCode) != SDO_FINISHED)
		printf("Master : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
	else
	{
		/* Display data received */
		switch(get_info_step)
		{
			case 1:
					printf("Device type     : %x\n", data);
					break;
			case 2:
					printf("Vendor ID       : %x\n", data);
					break;
			case 3:
					printf("Product Code    : %x\n", data);
					break;
			case 4:
					printf("Revision Number : %x\n", data);
					break;
		}
	}
	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);

	GetSlaveNodeInfo(nodeid);
}
예제 #2
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCAN::CheckHighWriteSDO(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    if(getWriteResultNetworkDict(d, nodeid, &abortCode) != SDO_FINISHED)
        printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
    readNetworkDictCallback(d, nodeid, 0x6200, 2, 0, &QCAN::CheckHighReadSDO, 0);
}
예제 #3
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCAN::CheckWriteSDO(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    QCAN* can = (QCAN*)d->classObject;
    if(getWriteResultNetworkDict(d, nodeid, &abortCode) != SDO_FINISHED)
        printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
    can->signal();
}
예제 #4
0
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
{
        UNS32 abortCode;
        if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)

        /* Finalise last SDO transfer with this node */
        closeSDOtransfer(&Sensor_Board_Data, nodeId, SDO_CLIENT);

        ConfigureSlaveNode(d, nodeId);
}
예제 #5
0
/* Callback function that check the write SDO demand */
void SDO_write_callback(CO_Data* d, UNS8 nodeid)
{
	UNS32 abortCode;
	
	SDO_write_callback_result = getWriteResultNetworkDict(CANOpenShellOD_Data, nodeid, &SDO_write_callback_abortCode);
	
	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);
	sem_post(&Write_sem);
}
예제 #6
0
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
{
	UNS32 abortCode;	
	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
		eprintf("Master : Failed in initializing slave %2.2x, AbortCode :%4.4x \n", nodeId, abortCode);

	/* Finalise last SDO transfer with this node */
	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);

	ConfigureSlaveNode(d, nodeId);
}
예제 #7
0
/* Callback function that check the read SDO demand */
void SDO_read_callback(CO_Data* d, UNS8 nodeid)
{

	SDO_read_data_size = 255;
	SDO_read_callback_result = getReadResultNetworkDict(CANOpenShellOD_Data, nodeid, &SDO_read_data, &SDO_read_data_size, &SDO_read_callback_abortCode);

	SDO_read_data[SDO_read_data_size] = 0;
	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);
	sem_post(&Read_sem);
}
예제 #8
0
void WriteResultNetworkDict(CO_Data* d, UNS8 nodeId)
{
    UNS32 abortCode;

    if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED){

    }

    /* Finalise last SDO transfer with this node */
    closeSDOtransfer(&master_Data, nodeId, SDO_CLIENT);

}
예제 #9
0
/* Callback function that check the write SDO demand */
void CheckWriteSDO(CO_Data* d, UNS8 nodeid)
{
	UNS32 abortCode;

	if(getWriteResultNetworkDict(CANOpenShellOD_Data, nodeid, &abortCode) != SDO_FINISHED)
		printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
	else
		printf("\nSend data OK\n");

	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);
}
예제 #10
0
/* Callback function that check the read SDO demand */
void CheckReadSDO(CO_Data* d, UNS8 nodeid)
{
	UNS32 abortCode;
	UNS32 data=0;
	UNS32 size=64;

	if(getReadResultNetworkDict(CANOpenShellOD_Data, nodeid, &data, &size, &abortCode) != SDO_FINISHED)
		printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
	else
		printf("\nResult : %x\n", data);

	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);
}
예제 #11
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCAN::CheckLowReadSDO(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    UNS32 data=0;
    UNS32 size=sizeof(data);

    if(getReadResultNetworkDict(d, nodeid, &data, &size, &abortCode) != SDO_FINISHED)
        printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    else {
        QCAN* can = (QCAN*)d->classObject;
        emit can->low2057Values(data);
    }
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
}
예제 #12
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCAN::CheckReadPWM(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    UNS16 data;
    UNS32 size=sizeof(data);

    QCAN* can = (QCAN*)d->classObject;
    if(getReadResultNetworkDict(d, nodeid, &data, &size, &abortCode) != SDO_FINISHED) {
        printf("\nResult : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    } else {
        can->mPwmDuty = data;
    }
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
    can->signal();
}
예제 #13
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCan::CheckReadId(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    UNS32 data=0;
    UNS32 size=64;

    QCan* can = (QCan*)d->classObject;
    if(getReadResultNetworkDict(d, nodeid, &data, &size, &abortCode) != SDO_FINISHED) {
        printf("Master : Failed in reading information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    } else {
        can->mID = data;
    }
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
    can->signal();
}
예제 #14
0
void CheckReadTitleSDO(CO_Data* d, UNS8 nodeid)
{
	UNS32 abortCode;
    	char data[255];
	UNS32 size=sizeof(data);;

	if(getReadResultNetworkDict(CANOpenShellOD_Data, nodeid, data, &size, &abortCode) != SDO_FINISHED)
		printf("Master : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
	else
	{
		printf("Device title     : %s\n", data);
	}
	/* Finalize last SDO transfer with this node */
	closeSDOtransfer(CANOpenShellOD_Data, nodeid, SDO_CLIENT);
}
예제 #15
0
파일: qcan.cpp 프로젝트: sseitov/Megatron
void QCAN::CheckReadTitle(CO_Data* d, UNS8 nodeid)
{
    UNS32 abortCode;
    char data[255];
    UNS32 size=sizeof(data);

    QCAN* can = (QCAN*)d->classObject;
    if(getReadResultNetworkDict(d, nodeid, data, &size, &abortCode) != SDO_FINISHED) {
        printf("Master : Failed in getting information for slave %2.2x, AbortCode :%4.4x \n", nodeid, abortCode);
    } else {
        can->mTitle = QString((const char*)data);
    }
    closeSDOtransfer(d, nodeid, SDO_CLIENT);
    can->signal();
}
예제 #16
0
파일: dcf.c 프로젝트: Prepodkiller/STM32
/**
**
**
** @param d
** @param nodeId
*/
static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
{
    UNS32 abortCode = 0;

    if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
    {
        MSG_ERR(0x1A01, "SDO error in consise DCF", abortCode);
        MSG_WAR(0x2A02, "server node : ", nodeId);
    }

    closeSDOtransfer(d, nodeId, SDO_CLIENT);
    /* Timedout ? */
    if(abortCode == SDOABT_TIMED_OUT) {
        /* Node may not be ready, try another one */
        /* Warning, this might leed to endless attempts */
        /* if node does never answer */
        SEEK_NEXT_DCF()
    }
    send_consise_dcf_loop(d,nodeId);
}
예제 #17
0
파일: main.c 프로젝트: Farewellly/STM32
UNS8 ReadSDO(UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, void* data, UNS8* size)
   {
   UNS32 abortCode = 0;
   UNS8 res = SDO_UPLOAD_IN_PROGRESS;
   // Read SDO
   UNS8 err = readNetworkDict (&win32test_Data, nodeId, index, subIndex, dataType);
   if (err)
      return 0xFF;
   for(;;)
      {
      res = getReadResultNetworkDict (&win32test_Data, nodeId, data, size, &abortCode);
      if (res != SDO_UPLOAD_IN_PROGRESS)
         break;   
      sleep_proc(1);
      continue;
      }
   closeSDOtransfer(&win32test_Data, nodeId, SDO_CLIENT);
   if (res == SDO_FINISHED)
      return 0;
   return 0xFF;   
   }
예제 #18
0
void CANUi::mReadResultNetworkDict(CO_Data* d, UNS8 nodeId)
{
    UNS32 abortCode;

    UNS32 _dataSize;
    UNS8 _dataType = this->ui->comboBox_sdoDatatype->currentData().value<UNS8>();

    if(_dataType == uint8){
        _dataSize = sizeof(UNS8);
    }
    else if(_dataType == uint16){
        _dataSize = sizeof(UNS16);
    }
    else{
        _dataSize = sizeof(UNS32);
    }
    UNS32 data;

    if(getReadResultNetworkDict (d, nodeId, &data, &_dataSize,
                                      &abortCode)!=SDO_FINISHED){

    }

    if(_dataType == uint8){
        ui->spinBox_sdoData->setValue((UNS8)data);
    }
    else if(_dataType == uint16){
        ui->spinBox_sdoData->setValue((UNS16)data);
    }
    else{
        ui->spinBox_sdoData->setValue((UNS32)data);
    }


    /* Finalise last SDO transfer with this node */
    closeSDOtransfer(&master_Data, nodeId, SDO_CLIENT);

}