use of net.sourceforge.usbdm.peripherals.model.DeviceModel in project usbdm-eclipse-plugins by podonoghue.
the class GdbDsfSessionListener method handleDsfEvent.
/**
*/
@DsfServiceEventHandler
public void handleDsfEvent(ISuspendedDMEvent event) {
String sessionId = event.getDMContext().getSessionId();
UsbdmDevicePeripheralsModel devicePeripheralsModel = dsfSessions.get(sessionId);
if (devicePeripheralsModel != null) {
DeviceModel deviceModel = devicePeripheralsModel.getModel();
if (deviceModel != null) {
// Set current register values as the 'reference' for changed values
deviceModel.setChangeReference();
// Set all registers as stale
deviceModel.setNeedsUpdate(true);
}
}
for (GdbSessionListener sessionListener : gdbSessionListeners) {
sessionListener.sessionSuspended(devicePeripheralsModel, GdbSessionListener.EventType.getEventFromDsfEvent(event.getReason()));
}
}
use of net.sourceforge.usbdm.peripherals.model.DeviceModel in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmDevicePeripheralsView method sessionSuspended.
/* (non-Javadoc)
* @see net.sourceforge.usbdm.peripherals.view.GdbSessionListener#sessionSuspended(net.sourceforge.usbdm.peripherals.model.UsbdmDevicePeripheralsModel, net.sourceforge.usbdm.peripherals.view.GdbSessionListener.EventType)
*/
@Override
public void sessionSuspended(final UsbdmDevicePeripheralsModel model, GdbSessionListener.EventType reason) {
if (model != null) {
DeviceModel deviceModel = model.getModel();
if (deviceModel != null) {
// Set current register values as the 'reference' for changed values
deviceModel.setChangeReference();
// Set all registers as stale
deviceModel.setNeedsUpdate(true);
}
}
// System.err.println("UsbdmDevicePeripheralsView.SessionSuspend() - reason = " + reason);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if ((fPeripheralsTreeViewer == null) || fPeripheralsTreeViewer.getControl().isDisposed()) {
// System.err.println("UsbdmDevicePeripheralsView.SessionTerminate() - no peripheral view or already disposed()");
return;
}
if (peripheralsModel == null) {
// System.err.println("UsbdmDevicePeripheralsView.sessionTerminated() - periperalsModel == null");
return;
}
if (peripheralsModel != model) {
// System.err.println("UsbdmDevicePeripheralsView.sessionTerminated() - periperalsModel != aPeriperalsModel");
return;
}
Object[] visibleObjects = fPeripheralsTreeViewer.getExpandedElements();
for (Object object : visibleObjects) {
if (object instanceof PeripheralModel) {
((PeripheralModel) object).forceUpdate();
}
}
}
});
}
Aggregations