static int slider_msg_proc (skin_item_t* item, int message, WPARAM wparam, LPARAM lparam) { int pos = 0; if ( item->style & SI_NRMSLIDER_STATIC ) return 0; /* assert (item != NULL) */ switch (message) { // case SKIN_MSG_CLICK: /* SLIDER_CHANGED event */ case SKIN_MSG_LBUTTONDOWN: case SKIN_MSG_MOUSEDRAG: /* SLIDER_CHANGED event */ pos = get_changed_pos (item, (int)wparam, (int)lparam); /* default operation */ if (skin_get_thumb_pos (item->hostskin, item->id) != pos) { skin_set_thumb_pos ( item->hostskin, item->id, pos); RAISE_EVENT ( SIE_SLIDER_CHANGED, (void *)pos ); } break; case SKIN_MSG_SETFOCUS: RAISE_EVENT ( SIE_GAIN_FOCUS, NULL ); break; case SKIN_MSG_KILLFOCUS: RAISE_EVENT ( SIE_LOST_FOCUS, NULL ); break; } return 1; }
bool USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress, uint16_t* const DescriptorSize) { RAISE_EVENT(USB_DeviceError, DEVICE_ERROR_GetDescriptorNotHooked); return false; };
bool CPMTraceEraserAppLayer::objects_register() { try { //*************************************** // Register objects with ORB // <-- //ObjToRegister<CPMObjDummy_i> obj(cpm_obj_dummy_, // "CPMObjDummy", // "CPMObjDummy_in_AOT"); //obj.register_with_ior_table(objects_ids_); //ObjToRegister<CPMObjDummy_i> obj2(cpm_obj_dummy2_, // "CPMObjDummy2", // "CPMObjDummy2_in_AOT"); //obj2.register_with_ior_table(objects_ids_); //*************************************** } catch(...) { RAISE_EVENT(CPMTraceEraserEvents::ev_object_registration_with_ior_table_failure2, LM_ERROR); return false; } return true; }
bool CPMTraceEraserAppLayer::init_corba_objects() { try { tao_layer_->register_with_ior_table< CPMO_i, ::ICPM_module::ICPMProcess> ( &obj_impl_, (cpmo_id_ + "_in_AOT").c_str(), cpmo_id_.c_str() ); } catch(...) { RAISE_EVENT(CPMTraceEraserEvents::ev_object_registration_with_ior_table_failure, LM_ERROR, cpmo_id_.c_str()); return false; } if (!objects_init()) { return false; } if (!objects_register()) { return false; } return true; }
static int button_msg_proc (skin_item_t* item, int message, WPARAM wparam, LPARAM lparam) { /* assert (item != NULL) */ switch (message) { case SKIN_MSG_LBUTTONDOWN: /* click-down event */ //RAISE_EVENT ( SIE_LBUTTONDOWN, NULL ); /*item msg not defined*/ /* default operation */ skin_set_check_status ( item->hostskin, item->id, TRUE ); /*button down*/ break; case SKIN_MSG_LBUTTONUP: /* click-up event */ //RAISE_EVENT ( SIE_LBUTTONUP, NULL ); /*item msg not defined*/ /* default operation */ skin_set_check_status ( item->hostskin, item->id, FALSE ); /*button up*/ break; case SKIN_MSG_CLICK: /* CLICK event */ RAISE_EVENT ( SIE_BUTTON_CLICKED, NULL ); /* default operation */ skin_set_check_status ( item->hostskin, item->id, FALSE ); /* button up */ break; case SKIN_MSG_MOUSEDRAG: //RAISE_EVENT ( SIE_MOUSEDRAG, NULL ); /* default operation */ if ( PtInRegion (&item->region, (int)wparam, (int)lparam) ){ /* if mouse moves in, click-down item */ if (!skin_get_check_status(item->hostskin, item->id)) skin_set_check_status ( item->hostskin, item->id, TRUE); /*button down*/ } else{ /* if mouse moves out, click-up item */ if (skin_get_check_status(item->hostskin, item->id)) skin_set_check_status ( item->hostskin, item->id, FALSE); /*button up*/ } break; case SKIN_MSG_SETFOCUS: RAISE_EVENT ( SIE_GAIN_FOCUS, NULL ); break; case SKIN_MSG_KILLFOCUS: RAISE_EVENT ( SIE_LOST_FOCUS, NULL ); break; } return 1; }
bool CPMTraceEraserAppLayer::objects_init() { try { if (!cpm_trace_eraser_obj_.init()) { RAISE_EVENT(CPMTraceEraserEvents::ev_object_init_failure, LM_ERROR); return false; } } catch(...) { RAISE_EVENT(CPMTraceEraserEvents::ev_object_init_failure, LM_ERROR); return false; } return true; }
bool XyzAppLayer::objects_init() { try { if (!cpm_obj_dummy_.init_i()) { RAISE_EVENT(XyzEvents::ev_object_init_failure, LM_ERROR); return false; } } catch(...) { RAISE_EVENT(XyzEvents::ev_object_init_failure, LM_ERROR); return false; } return true; }
void read_packet_from_socket(options_t* opts, int raw_socket) { u8_t buffer[65536]; int datasize; datasize = recvfrom(raw_socket, buffer, sizeof(buffer), 0, NULL, NULL); struct packet_data data; data.chrs = malloc(datasize); memcpy(data.chrs, buffer, datasize); data.sz = datasize; RAISE_EVENT(packet_event, new_packet_event(&data, ID_PACKET_RECIEVED)); }
void USB_ShutDown(void) { if (USB_IsConnected) RAISE_EVENT(USB_Disconnect); USB_INT_DisableAllInterrupts(); USB_INT_ClearAllInterrupts(); USB_IsConnected = false; USB_IsInitialized = false; #if defined(USB_CAN_BE_HOST) USB_HostState = HOST_STATE_Unattached; #endif #if defined(USB_CAN_BE_DEVICE) USB_ConfigurationNumber = 0; #endif #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) USB_CurrentMode = USB_MODE_NONE; #endif #if !defined(USE_STATIC_OPTIONS) USB_Options = 0; #endif USB_Interface_Disable(); USB_PLL_Off(); #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) USB_OTGPAD_Off(); #endif #if defined(USB_CAN_BE_BOTH) UHWCON &= ~(1 << UIDE); #endif }
ISR(USB_GEN_vect, ISR_BLOCK) { #if defined(USB_CAN_BE_DEVICE) #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) if (USB_INT_HasOccurred(USB_INT_VBUS) && USB_INT_IsEnabled(USB_INT_VBUS)) { USB_INT_Clear(USB_INT_VBUS); RAISE_EVENT(USB_VBUSChange); if (USB_VBUS_GetStatus()) { RAISE_EVENT(USB_VBUSConnect); if (USB_IsConnected) RAISE_EVENT(USB_Disconnect); USB_ResetInterface(); USB_IsConnected = true; RAISE_EVENT(USB_Connect); } else { RAISE_EVENT(USB_Disconnect); USB_Detach(); USB_CLK_Freeze(); USB_PLL_Off(); USB_REG_Off(); USB_IsConnected = false; RAISE_EVENT(USB_VBUSDisconnect); USB_INT_Clear(USB_INT_VBUS); } } #endif if (USB_INT_HasOccurred(USB_INT_SUSPEND) && USB_INT_IsEnabled(USB_INT_SUSPEND)) { USB_INT_Clear(USB_INT_SUSPEND); USB_INT_Disable(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_WAKEUP); USB_CLK_Freeze(); if (!(USB_Options & USB_OPT_MANUAL_PLL)) USB_PLL_Off(); USB_IsSuspended = true; RAISE_EVENT(USB_Suspend); #if defined(USB_LIMITED_CONTROLLER) && !defined(NO_LIMITED_CONTROLLER_CONNECT) if (USB_IsConnected) { USB_IsConnected = false; RAISE_EVENT(USB_Disconnect); } #endif } if (USB_INT_HasOccurred(USB_INT_WAKEUP) && USB_INT_IsEnabled(USB_INT_WAKEUP)) { if (!(USB_Options & USB_OPT_MANUAL_PLL)) { USB_PLL_On(); while (!(USB_PLL_IsReady())); } USB_CLK_Unfreeze(); USB_INT_Clear(USB_INT_WAKEUP); USB_INT_Disable(USB_INT_WAKEUP); USB_INT_Enable(USB_INT_SUSPEND); #if defined(USB_LIMITED_CONTROLLER) && !defined(NO_LIMITED_CONTROLLER_CONNECT) if (!(USB_IsConnected)) { USB_IsConnected = true; RAISE_EVENT(USB_Connect); } #endif USB_IsSuspended = false; RAISE_EVENT(USB_WakeUp); } if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI)) { USB_INT_Clear(USB_INT_EORSTI); USB_ConfigurationNumber = 0; USB_INT_Clear(USB_INT_SUSPEND); USB_INT_Disable(USB_INT_SUSPEND); USB_INT_Enable(USB_INT_WAKEUP); Endpoint_ClearEndpoints(); Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, ENDPOINT_DIR_OUT, USB_ControlEndpointSize, ENDPOINT_BANK_SINGLE); RAISE_EVENT(USB_Reset); } #endif #if defined(USB_CAN_BE_HOST) if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI)) { USB_INT_Clear(USB_INT_DDISCI); USB_INT_Clear(USB_INT_DCONNI); USB_INT_Disable(USB_INT_DDISCI); RAISE_EVENT(USB_DeviceUnattached); RAISE_EVENT(USB_Disconnect); USB_ResetInterface(); } if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI)) { USB_INT_Clear(USB_INT_VBERRI); USB_Host_VBUS_Manual_Off(); USB_Host_VBUS_Auto_Off(); RAISE_EVENT(USB_HostError, HOST_ERROR_VBusVoltageDip); RAISE_EVENT(USB_DeviceUnattached); USB_HostState = HOST_STATE_Unattached; } if (USB_INT_HasOccurred(USB_INT_SRPI) && USB_INT_IsEnabled(USB_INT_SRPI)) { USB_INT_Clear(USB_INT_SRPI); USB_INT_Disable(USB_INT_SRPI); RAISE_EVENT(USB_DeviceAttached); USB_INT_Enable(USB_INT_DDISCI); USB_HostState = HOST_STATE_Attached; } if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI)) { USB_INT_Clear(USB_INT_BCERRI); RAISE_EVENT(USB_DeviceEnumerationFailed, HOST_ENUMERROR_NoDeviceDetected, 0); RAISE_EVENT(USB_DeviceUnattached); if (USB_IsConnected) RAISE_EVENT(USB_Disconnect); USB_ResetInterface(); } #endif #if defined(USB_CAN_BE_BOTH) if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI)) { USB_INT_Clear(USB_INT_IDTI); if (USB_IsConnected) { if (USB_CurrentMode == USB_MODE_HOST) RAISE_EVENT(USB_DeviceUnattached); else RAISE_EVENT(USB_Disconnect); } RAISE_EVENT(USB_UIDChange); USB_ResetInterface(); } #endif }
void USB_Init( #if defined(USB_CAN_BE_BOTH) const uint8_t Mode #endif #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) , #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) void #endif #if !defined(USE_STATIC_OPTIONS) const uint8_t Options #endif ) { if (USB_IsInitialized) USB_ShutDown(); #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) USB_CurrentMode = Mode; #endif #if defined(USB_DEVICE_ONLY) #if defined(USB_FULL_CONTROLLER) UHWCON |= (1 << UIMOD); #endif #elif defined(USB_HOST_ONLY) UHWCON &= ~(1 << UIMOD); #else if (Mode == USB_MODE_NONE) { RAISE_EVENT(USB_PowerOnFail, POWERON_ERROR_NoUSBModeSpecified); return; } else if (Mode == USB_MODE_UID) { UHWCON |= (1 << UIDE); USB_INT_Clear(USB_INT_IDTI); USB_INT_Enable(USB_INT_IDTI); USB_CurrentMode = USB_GetUSBModeFromUID(); } else if (Mode == USB_MODE_DEVICE) { UHWCON |= (1 << UIMOD); } else if (Mode == USB_MODE_HOST) { UHWCON &= ~(1 << UIMOD); } #endif #if defined(USB_CAN_BE_BOTH) USB_InitTaskPointer(); #else USB_IsInitialized = true; #endif #if defined(USB_CAN_BE_HOST) USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; #endif #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) USB_OTGPAD_On(); #endif #if !defined(USE_STATIC_OPTIONS) USB_Options = Options; #endif #if defined(USB_DEVICE_ONLY) #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) USB_INT_Enable(USB_INT_VBUS); #else USB_SetupInterface(); #endif #elif defined(USB_HOST_ONLY) USB_SetupInterface(); #else if (USB_CurrentMode == USB_MODE_DEVICE) USB_INT_Enable(USB_INT_VBUS); else USB_SetupInterface(); #endif sei(); }
bool CPMMAppLayer::run() { INIT_RAISER_RETURN(false); //CPMTRACER->trace("%s - cpmm_obj_impl_.init_i...", _SRC); if (!cpmm_obj_impl_.init_i(overwrite_autostart_to_false_)) { RAISE_EVENT(CPMMEvents::ev_cpmm_object_init_failure, LM_ERROR); return false; } //CPMTRACER->trace("%s - tao_layer_->register_with_ior_table<%s>", _SRC, cpmo_id_.c_str()); //ACE_DEBUG((LM_DEBUG, "CPMMAppLayer::run() - cpmo_id_ = %s\n", cpmo_id_.c_str())); try { tao_layer_->register_with_ior_table< CPMO_i, ::ICPM_module::ICPMProcess> ( &obj_impl_, (cpmo_id_ + "_in_AOT").c_str(), cpmo_id_.c_str() ); } catch(...) { RAISE_EVENT(CPMMEvents::ev_object_registration_with_ior_table_failure, LM_ERROR, cpmo_id_.c_str()); return false; } std::string cpmm_object_id("CPMMObj"); //CPMTRACER->trace("%s - tao_layer_->register_with_ior_table<%s>", _SRC, cpmm_object_id.c_str()); //ACE_DEBUG((LM_DEBUG, "CPMMAppLayer::run() - object_id = %s\n", object_id.c_str())); try { tao_layer_->register_with_ior_table< CPMMObj_i, ::ICPM_module::ICPMM> ( &cpmm_obj_impl_, "CPMMObj_in_AOT", cpmm_object_id.c_str() ); } catch(...) { RAISE_EVENT(CPMMEvents::ev_object_registration_with_ior_table_failure, LM_ERROR, cpmm_object_id.c_str()); return false; } // Since ev_server_stopped event is generated at the main() level and that it is // as a system log event, we generate ev_server_started as a system log too. EVENT_HANDLER_SYSTEMLOG->handle_event( _SRC, CPMMEvents::ev_server_started, LM_INFO, cpmo_id_.c_str()); if (int rc = cpmm_obj_impl_.activate() != 0) { EVENT_HANDLER_SYSTEMLOG->handle_event( _SRC, CPMMEvents::ev_task_activation_failure, LM_ERROR, rc); return false; } ACE_DEBUG((LM_INFO, "%s server started, waiting for requests...\n\n", cpmo_id_.c_str())); try { tao_layer_->orb()->run(); } catch(...) { return false; } //CPMTRACER->trace("%s - return true.", _SRC); return true; }