示例#1
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is
       to support dynamic device binding to us */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
    /* handle the ack coming back */
    apdu_set_confirmed_simple_ack_handler
        (SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        MyDeviceCommunicationControlSimpleAckHandler);
    /* handle any errors coming back */
    apdu_set_error_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        MyErrorHandler);
    apdu_set_abort_handler(MyAbortHandler);
    apdu_set_reject_handler(MyRejectHandler);
}
示例#2
0
CoriFlow::CoriFlow( const ioport_t ioPort )
  : VCoriFlow(ioPort),
    uDelay_(100000)
{
  comHandler_ = new CoriFlowComHandler( ioPort );
  Device_Init();
}
示例#3
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is
       to support dynamic device binding to us */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, LocalIAmHandler);
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    /* handle the data coming back from confirmed requests */
    apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        AtomicReadFileAckHandler);
    /* handle any errors coming back */
    apdu_set_error_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        Atomic_Read_File_Error_Handler);
    apdu_set_abort_handler(MyAbortHandler);
    apdu_set_reject_handler(MyRejectHandler);
}
示例#4
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is
       to support dynamic device binding to us */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);

    apdu_set_confirmed_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER,
        handler_conf_private_trans);
    /* handle the data coming back from confirmed requests */
    apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property_ack);

    apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER,
        handler_conf_private_trans_ack);

    /* handle any errors coming back */
    apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
    apdu_set_error_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER, MyErrorHandler);
    apdu_set_abort_handler(MyAbortHandler);
    apdu_set_reject_handler(MyRejectHandler);
}
HuberPetiteFleur::HuberPetiteFleur( const ioport_t ioPort )
  : VHuberPetiteFleur(ioPort),
    uDelay_(250000)
{
  comHandler_ = new PetiteFleurComHandler( ioPort );
  isCommunication_ = false;
  Device_Init();
}
示例#6
0
/** Initialize the handlers we will utilize.
 * @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
 */
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE,
        handler_write_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
    /*added for wp ao.h handler in apdu.c*/
    wp_set_execute_fun(Execute_AO_WP);
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        handler_atomic_read_file);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
        handler_atomic_write_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
    /* handle the data coming back from private requests */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_PRIVATE_TRANSFER,
        handler_unconfirmed_private_transfer);
#if defined(INTRINSIC_REPORTING)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM,
        handler_alarm_ack);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_EVENT_INFORMATION,
        handler_get_event_information);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_ALARM_SUMMARY,
        handler_get_alarm_summary);
#endif /* defined(INTRINSIC_REPORTING) */
}
示例#7
0
/***********************************************************
*   函数说明:系统初始化函数                               *
*   输入:    无                                           *
*   输出:    无                                           *
*   调用函数:Device_Init() Driver_Init()                  *
***********************************************************/
void System_Init(void)
{
	Driver_Init();  /* 先初始化串口缓冲区, mark by David */
	Device_Init();

#if USE_STM32_IWDG
	iwdg_init();
#endif
	//*在这里插入你的系统环境变量初始化代码*//

	//LED_WORK = LED_FLASH_SLOW;
}
示例#8
0
int CPowerSupply::InitDevice(const CString & strAddr, int iPort)
{   

	int iDeviceErr;
	CString strCmd;
    strCmd.Format(_T("%s::%s"),strAddr,"INSTR");
	if((iDeviceErr=Device_Init(strCmd))!=DEVICE_SUCCESS)
		return iDeviceErr;
  
    m_iPort = iPort;
	return DEVICE_SUCCESS;
	
}
示例#9
0
/***********************************************************
*   函数说明:系统初始化函数                               *
*   输入:    无                                           *
*   输出:    无                                           *
*   调用函数:Device_Init() Driver_Init()                  *
***********************************************************/
void System_Init(void)
{
	Driver_Init();

	stm32f10x_it_init();

	Device_Init();
#if USE_STM32_IWDG
	iwdg_init();
#endif

	//*在这里插入你的系统环境变量初始化代码*//
	//LED_WORK = LED_FLASH_SLOW;
}
示例#10
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);

    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, LocalIAmHandler);

    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    /* handle the data coming back from confirmed requests */
    apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property_ack);
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        handler_atomic_read_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);

#if 0
    /* Adding these handlers require the project(s) to change. */
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
        handler_atomic_write_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
#endif
}
示例#11
0
int CFuncCDMATest_CMU::ICDMATestInitCDMANStest(const CString& strAddr,const CString strWavefile)
{
	CString strCmd;
	int iDeviceErr;
	CString strRes;


	if((iDeviceErr=Device_Init(strAddr))!=DEVICE_SUCCESS)
		return iDeviceErr;

/*
	strCmd.Format(_T("%s::%s"),strAddr,"0::INSTR");
	if((iDeviceErr=Device_Init(strCmd))!=DEVICE_SUCCESS)
		return iDeviceErr;*/

	strCmd=_T("*CLS");
	DEVICE_WRITE(strCmd)
		strCmd=_T("0;SYST:REM:ADDR:SEC? 1");
	DEVICE_QUERY(strCmd)
		strRes=Device_GetReadBuf();
	if (strRes.Find("CDMA2KCellMS_NSig")==-1)
	{
		strCmd=_T("0;SYST:REM:ADDR:SEC 1,NONE");
		DEVICE_WRITE(strCmd)
		strCmd=_T("0;SYST:REM:ADDR:SEC 1,\"CDMA2KCellMS_NSig\"");
		DEVICE_WRITE(strCmd)
			strCmd=_T("0;SYST:REM:ADDR:SEC? 1");
		DEVICE_QUERY(strCmd)
			strRes=Device_GetReadBuf();
		if (strRes.Find("CDMA2KCellMS_NSig")==-1)
		{
			MessageBox(NULL,_T("Device fast switch CDMA2KCellMS_NSig fail!"),_T("WARNING"),MB_OK);
			return DEVICE_WRITE_FAIL;
		}


	}
	strCmd=_T("0;SYST:RES:CURR;*OPC?");
	DEVICE_QUERY(strCmd)


	if(m_pTesterDevice->m_bIsScreenOff)
	{
		strCmd=_T("0;DISPLAY OFF");
		DEVICE_WRITE(strCmd)

	}
示例#12
0
int main(void)
{
	RCC_Configuration();
	DeBug_Init();
	DeviceList_Init();
	DeviceMount_Usart1();
	DeviceMount_Led();
	DeviceMount_Flash();
	Device_Init();
	Tos_Init();
 	Tos_TaskCreate(0,Task0,Null,"Task_System",1000);
	//Tos_TaskCreate(1,Task_CAN_Slave,1000);
	Tos_TaskCreate(1,Sensor_Command,Null,"Task_System",1000);
	Tos_TaskCreate(3,TaskReadADC,Null,"TaskReadADC",2000);
	Tos_Start();
	while(1);
}
示例#13
0
/**
 * [KernelFile_Init description]
 */
void KernelFile_Init(void)
{
	unsigned* pCount;
	unsigned  iSum;
	unsigned  i;

	Device_Init();
	KernelFile__pFileSystem = &Device__sFileSystem;
	pCount                  = KernelFile__pFileSystem->pOpenCount;
	iSum                    = KernelFile__pFileSystem->iFileSum;
	for (i = 0; i < iSum; ++i)
		pCount[i] = 0;
	KernelFile__pOpenCount = pCount;
#if (DEBUG)
	KernelFile__iFileSumMax = iSum;
#endif
}
示例#14
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is
       to support dynamic device binding to us */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
}
示例#15
0
/****************************************************************************
Date:2015-01-23
Func:主函数
Note:
****************************************************************************/
int main(void)
{
	RCC_Configuration();
	DeBug_Init();
	DeviceList_Init();
	DeviceMount_Usart1();
	DeviceMount_Led();
	DeviceMount_Flash();
	DeviceMount_Control();
	DeviceMount_Signel();
	Device_Init();
	Tos_Init();
 	Tos_TaskCreate(0,Task0,Null,"Tast0",3000);
	Tos_TaskCreate(1,Task_ADCFitel,Null,"ADC-Reader",3000);
	Tos_TaskCreate(2,Task2,Null,"ADC-Reader",3000);
	Tos_Start();
	while(1);
}
示例#16
0
int main(void)
{
	RCC_Configuration();
	DeBug_Init();
	DeviceList_Init();
	DeviceMount_Usart1();
	DeviceMount_Control();
	DeviceMount_Signel();//挂在信号采集设备
	DeviceMount_Flash();
	Device_Init();
	Tos_Init();
 	Tos_TaskCreate(0,Task0,Null,"Tast0",3000);
	Tos_TaskCreate(1,Task_CAN_SIGMY,Null,"Tast2",3000);
	Tos_TaskCreate(2,Task_ADCFitel,Null,"Tast2",3000);
	Tos_TaskCreate(3,TaskReadCanToCom,Null,"Tast2",3000);
	Tos_Start();
	while(1);
}
示例#17
0
int main(void)
{
    RCC_Configuration();
    DeBug_Init();
    DeviceList_Init();
    DeviceMount_Usart1();
    DeviceMount_Usart2();
    DeviceMount_Control();
    DeviceMount_Signel();
    DeviceMount_Can1();
    Device_Init();
    Tos_Init();
    Tos_TaskCreate(0,Task0,Null,"Tast0",3000);
    Tos_TaskCreate(1,Task_Moto,Null,"Tast0",1000);
    Tos_TaskCreate(2,TaskCanRead,Null,"Tast0",1000);
    Tos_TaskCreate(3,Usart_Cmd,Null,"Tast0",1000);
    Tos_Start();
    while(1);
}
示例#18
0
int main()
{
	/* To get the basic info */
	BasicDeviceInfo DevInfo;
	strcpy(DevInfo.SN, "test-netgear");
	strcpy(DevInfo.Model, "R7000");
	strcpy(DevInfo.MAC, "A1B2C3D4E5F6");
	Device_Init(&DevInfo, "example2", on_cmd_test);
	
	/* To do what you want */
	pthread_t ntid;
	int err = pthread_create(&ntid, NULL, thr_fn, NULL);
	
	/* Go to event loop,block the main thread */
	Device_Run(NULL, 1);

	Device_Destroy();
	return 0;
}
示例#19
0
static void init_service_handlers(
    void)
{
    Device_Init(NULL);
    /* Note: this applications doesn't need to handle who-is
       it is confusing for the user! */
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    /* handle the reply (request) coming back */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, my_i_am_handler);
    /* handle any errors coming back */
    apdu_set_abort_handler(MyAbortHandler);
    apdu_set_reject_handler(MyRejectHandler);
}
示例#20
0
文件: Tos.c 项目: tongjingyu/Prj
/********************************************************************************
 Func: 核心任务也可认为是空闲任务
 Time: 2014-6-13
 Ver.: V4.0
 Note;
********************************************************************************/
void Tos_RootTask(void *Tags)
{
	
	Device_Init();//设备初始化放在系统未启动时会导致部分驱动异常,如fmsc
#ifdef IWDG_ENABLE
	IWDG_Configuration();
#endif
#ifdef APPLIC_ENABLE
	if(!AppLicense())return;//注册设备
#endif
	while(1)
	{
#ifdef IWDG_ENABLE
		IWDG_ReloadCounter();//系统狗/使能休眠功能后需要关闭系统狗
#endif
		Tos_TaskDelay(100);
		Tos_ScanTimer();
	}
}
示例#21
0
/** Initialize the handlers we will utilize.
 * @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
 */
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE,
        handler_write_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
    /* handle the data coming back from private requests */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_PRIVATE_TRANSFER,
        handler_unconfirmed_private_transfer);
}
示例#22
0
/**************************************************************************
* Description: initializes the BACnet library
* Returns: none
* Notes: none
**************************************************************************/
void bacnet_init(void)
{
    unsigned i;

    Ringbuf_Init(&Receive_Queue, (uint8_t *) & Receive_Buffer,
        sizeof(struct mstp_rx_packet), MSTP_RECEIVE_PACKET_COUNT);
    dlmstp_init(NULL);
    /* initialize objects */
    Device_Init(NULL);
    /* set up our confirmed service unrecognized service handler - required! */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    /* handle communication so we can shut up when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
    /* start the cyclic 1 second timer for DCC */
    timer_interval_start_seconds(&DCC_Timer, DCC_CYCLE_SECONDS);
    /* start the cyclic 1 second timer for COV */
    timer_interval_start_seconds(&COV_Timer, COV_CYCLE_SECONDS);
    /* start the cyclic 1 second timer for TSM */
    timer_interval_start_seconds(&TSM_Timer, TSM_CYCLE_SECONDS);
	for (i = 0; i < MAX_ANALOG_INPUTS; i++) {
        Analog_Input_Units_Set(
            Analog_Input_Index_To_Instance(i),
            UNITS_PERCENT);
    }
}
示例#23
0
static void Init_Service_Handlers(
    void)
{
    Device_Init();
    handler_read_property_object_set(OBJECT_DEVICE,
        Device_Encode_Property_APDU, Device_Valid_Object_Instance_Number);
    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, LocalIAmHandler);

    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    /* handle the data coming back from confirmed requests */
    apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property_ack);
}
示例#24
0
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is
       to support dynamic device binding to us */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    /* set the handler for all the services we don't implement
       It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* we must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    /* handle the reply (request) coming in */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    /* handle any errors coming back */
    apdu_set_abort_handler(MyAbortHandler);
    apdu_set_reject_handler(MyRejectHandler);
}
示例#25
0
int CFunGSMTest_CMW::IGSMTestInitGSMtest_NSFT(const CString& strAddr,int iFreqMode,int iChan,int iPcl,int iBand)
{
	CString strCmd;
	int iDeviceErr;

	CString strRes;
	double DLFreq=0;
	double ULFreq=0;
	double ExpectPower=0;


	if((iDeviceErr=Device_Init(strAddr))!=DEVICE_SUCCESS)
		return iDeviceErr;

	strCmd=_T("SYSTEM:RESET \"GSM Sig\";*OPC?");
	DEVICE_QUERY(strCmd)

		strCmd=_T("ROUTe:GPRF:GENerator:SCENario:SALone RFAC, TX1;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("ROUTe:GSM:MEASurement:SCENario:SALone RFAC, RX1;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SYSTem:BASE:REFerence:FREQuency:SOURce INTernal;*OPC?");
	DEVICE_WRITE(strCmd)
		//GPRF GEN setup
		strCmd=_T("SOURCe:GPRF:GEN:STAT OFF;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("ABORT:GSM:MEAS:MEValuation");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:BBMode ARB");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:ARB:FILE \'D:\\Rohde-Schwarz\\CMW\\Data\\waveform\\library1\\loopC_1040.wv\'");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:ARB:FILE?");
	DEVICE_QUERY(strCmd)
		strRes=Device_GetReadBuf();
	if (-1==strRes.Find("loopC"))
	{
		MessageBox(NULL,_T("waveform open failed"),_T("WARNING"),MB_OK);
		return DEVICE_WRITE_FAIL;
	}
		strCmd=_T("SOURce:GPRF:GEN:ARB:REPetition CONTinuous");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GPRF:GEN:ARB:RETRigger ON");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GPRF:GEN:ARB:AUTostart ON");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GPRF:GEN:ARB:SEGMents:MODE CSEamless");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:LIST OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:STATe ON;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GEN:STATe?");
	DEVICE_QUERY(strCmd)
		strRes=Device_GetReadBuf();
	if (-1==strRes.Find("ON"))
	{
		MessageBox(NULL,_T("GPRF ON failed"),_T("WARNING"),MB_OK);
		return DEVICE_WRITE_FAIL;
	}
	//meas setup
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:TSEQuence TSC0");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:PCLMode PCL");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:PCL 5,5,5,5,5,5,5,5");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:RFSettings:UMARgin 5;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:RFSettings:ENPower 33;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("SOURce:GPRF:GENerator:RFSettings:LEVel -60;*OPC?");
	DEVICE_WRITE(strCmd)
		strCmd=_T("ABORt:GSM:MEAS:MEValuation");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:RESult:ALL OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:TOUT 10");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:REPetition SINGleshot");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:MOEXception OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:FCRange WIDE");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:HDALevel -50");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:NBQSearch OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:ABSearch OFF");
	DEVICE_WRITE(strCmd)

		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:VAMos:TSCSet 1");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:LIST OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:RPMode AVERage");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:FILTer:PVTime G05M");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:MODulation:DECode GTBits");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:MVIew GMSK,OFF,OFF,OFF,OFF,OFF,OFF,OFF");
	DEVICE_WRITE(strCmd)
		strCmd=_T("CONFigure:GSM:MEAS:MEValuation:MSLots 0,1,0");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GSM:MEAS:MEValuation:SOURce 'POWER'");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GSM:MEAS:MEValuation:SLOPe REDGe");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GSM:MEAS:MEValuation:THReshold -20");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GSM:MEAS:MEValuation:TOUT 5");
	DEVICE_WRITE(strCmd)
		strCmd=_T("TRIGger:GSM:MEAS:MEValuation:MGAP 0");
	DEVICE_WRITE(strCmd)
	

	if (iBand==FTM_GSM_BER_PCS_1900)
	{
		DLFreq=CGSMBandInfo::ArfcnToRXHz(GSM_PCS_BAND_ID,iChan);
		ULFreq=CGSMBandInfo::ArfcnToTXHz(GSM_PCS_BAND_ID,iChan);
		ExpectPower= 30.0- 2*iPcl;
	}
	else if(iBand==FTM_GSM_BER_DCS_1800)
	{
		DLFreq=CGSMBandInfo::ArfcnToRXHz(GSM_DCS_BAND_ID,iChan);
		ULFreq=CGSMBandInfo::ArfcnToTXHz(GSM_DCS_BAND_ID,iChan);
		ExpectPower= 30.0- 2*iPcl;
	}
	else if (iBand==FTM_GSM_BER_CELL_850)
	{
		DLFreq=CGSMBandInfo::ArfcnToRXHz(GSM_850_BAND_ID,iChan);
		ULFreq=CGSMBandInfo::ArfcnToTXHz(GSM_850_BAND_ID,iChan);
		ExpectPower= 43.0- 2*iPcl;
	}
	else if (iBand == FTM_GSM_BER_EGSM_900)
	{
		DLFreq=CGSMBandInfo::ArfcnToRXHz(GSM_EGSM_BAND_ID,iChan);
		ULFreq=CGSMBandInfo::ArfcnToTXHz(GSM_EGSM_BAND_ID,iChan);
		ExpectPower= 43.0- 2*iPcl;
	}
	else
	{
		return DEVICE_WRITE_FAIL;
	}
	strCmd.Format("SOURce:GPRF:GENerator:RFSettings:LEVel -60;*OPC?");
	DEVICE_QUERY(strCmd)
		strCmd.Format("SOURce:GPRF:GENerator:RFSettings:FREQuency %.2fMHz;*OPC?",DLFreq);
	DEVICE_QUERY(strCmd)
		strCmd.Format("CONFigure:GSM:MEAS:RFSettings:FREQuency %.2f MHz;*OPC?",ULFreq);
	DEVICE_WRITE(strCmd)
		strCmd.Format("CONFigure:GSM:MEAS:MEValuation:PCLMode PCL");
	DEVICE_WRITE(strCmd)
		strCmd.Format("CONFigure:GSM:MEAS:MEValuation:PCL %d,%d,%d,%d,%d,%d,%d,%d",iPcl,iPcl,iPcl,iPcl,iPcl,iPcl,iPcl,iPcl);
	DEVICE_WRITE(strCmd)
		strCmd.Format("CONFigure:GSM:MEAS:RFSettings:UMARgin 5;*OPC?");
	DEVICE_QUERY(strCmd)
		strCmd.Format("CONFigure:GSM:MEAS:RFSettings:ENPower %.2f;*OPC?",ExpectPower);
	DEVICE_QUERY(strCmd)
		strCmd.Format("SOURce:GPRF:GEN:STATe?");
	DEVICE_QUERY(strCmd)
		strRes=Device_GetReadBuf();
	if (-1<strRes.Find("ON"))
	{
		return DEVICE_SUCCESS;
	}

		return DEVICE_SUCCESS;
}
示例#26
0
int rtapi_app_main(void)
{
    int n;
    board_data_t *pboard;
    struct pci_dev *pDev;

    // Connect to the HAL.
    driver.comp_id = hal_init("opto_ac5");
    if (driver.comp_id < 0) {
        rtapi_print_msg(RTAPI_MSG_ERR, " ERROR OPTO_AC5--- hal_init() failed\n");
        return(-1);
    }
    for ( n = 0 ; n < MAX_BOARDS ; n++ ) {
        driver.boards[n] = NULL;
    }
    pDev = NULL;
    for ( n = 0 ; n < MAX_BOARDS ; n++ )
    {
        // Find a M5I20 card.
        pDev = pci_get_device(opto22_VENDOR_ID, opto22_pci_AC5_DEVICE_ID, pDev);
        if ( pDev == NULL ) {
            /* no more boards */break;
        }


        /* Allocate HAL memory for the board */
        pboard = (board_data_t *)(hal_malloc(sizeof(board_data_t)));
        if ( pboard == NULL ) {
            rtapi_print_msg(RTAPI_MSG_ERR, "ERROR OPTO_AC5--- hal_malloc() failed\n");
            rtapi_app_exit();
            return -1;
        }
        // save pointer
        driver.boards[n] = pboard;

        /* gather info about the board and save it */
        pboard->pci_dev = pDev;
        pboard->slot = PCI_SLOT(pDev->devfn);
        pboard->num = n;
        rtapi_print("INFO OPTO_AC5--- Board %d detected in PCI Slot: %2x\n", pboard->num, pboard->slot);
        /* region 0 is the 32 bit memory mapped I/O region */
        pboard->len = pci_resource_len(pDev, 0);
        pboard->base = ioremap_nocache(pci_resource_start(pDev, 0), pboard->len);
        if ( pboard->base == NULL ) {
            rtapi_print_msg(RTAPI_MSG_ERR,
                            "ERROR OPTO_AC5---  could not find board %d PCI base address\n", pboard->num );
            rtapi_app_exit();
            return -1;
        } else {
            rtapi_print(
                "INFO OPTO_AC5--- board %d mapped to %08lx, Len = %ld\n",
                pboard->num, (long)pboard->base,(long)pboard->len);
        }
        // Initialize device.
        if(Device_Init(pboard)) {
            hal_exit(driver.comp_id);
            return(-1);
        }

        // Export pins, parameters, and functions.
        if(Device_ExportPinsParametersFunctions(pboard, driver.comp_id, n)) {
            hal_exit(driver.comp_id);
            return(-1);
        }

    }

    if(n == 0) {
        /* No cards detected */
        rtapi_print ("ERROR OPTO_AC5---  No opto PCI-AC5 card(s) detected\n");
        rtapi_app_exit();
        return(-1);
    }

    hal_ready(driver.comp_id);
    return(0);
}
示例#27
0
/** Initialize the handlers we will utilize.
 * @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
 */
static void Init_Service_Handlers(
    void)
{
    Device_Init(NULL);
    /* we need to handle who-is to support dynamic device binding */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);

#if 0
	/* 	BACnet Testing Observed Incident oi00107
		Server only devices should not indicate that they EXECUTE I-Am
		Revealed by BACnet Test Client v1.8.16 ( www.bac-test.com/bacnet-test-client-download )
			BITS: BIT00040
		Any discussions can be directed to [email protected]
		Please feel free to remove this comment when my changes accepted after suitable time for
		review by all interested parties. Say 6 months -> September 2016 */
	/* In this demo, we are the server only ( BACnet "B" device ) so we do not indicate
	   that we can execute the I-Am message */
    /* handle i-am to support binding to other devices */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_bind);
#endif

    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE,
        handler_write_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        handler_atomic_read_file);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
        handler_atomic_write_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
    /* handle the data coming back from private requests */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_PRIVATE_TRANSFER,
        handler_unconfirmed_private_transfer);
#if defined(INTRINSIC_REPORTING)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM,
        handler_alarm_ack);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_EVENT_INFORMATION,
        handler_get_event_information);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_GET_ALARM_SUMMARY,
        handler_get_alarm_summary);
#endif /* defined(INTRINSIC_REPORTING) */
#if defined(BACNET_TIME_MASTER)
    handler_timesync_init();
#endif
}
示例#28
0
static void Init_Objects(
    void)
{
    Device_Init(NULL);
}