blob: 956fe0b733ffb8845596b9bbe4d39cf251daa929 [file] [log] [blame]
#include "Computer.hh"
#include "Resource.hh"
#include "ResourceManager.hh"
#include "USBDeviceDriver.hh"
#include "WordProcessorApp.hh"
#include "umlrtcapsuleclass.hh"
#include "umlrtcapsulepart.hh"
#include "umlrtcommsportrole.hh"
#include "umlrtmessage.hh"
#include "umlrtslot.hh"
#include "umlrttimerprotocol.hh"
#include <cstddef>
#include "umlrtcapsuleid.hh"
#include "umlrtcapsulerole.hh"
#include "umlrtcommsport.hh"
#include "umlrtframeservice.hh"
class UMLRTRtsInterface;
Capsule_Computer::Capsule_Computer( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat )
: UMLRTCapsule( NULL, cd, st, border, internal, isStat )
, frame( borderPorts[borderport_frame] )
, resMgr( internalPorts[internalport_resMgr] )
, timer( borderPorts[borderport_timer] )
, usbPort( borderPorts[borderport_usbPort] )
, userPort( borderPorts[borderport_userPort] )
, application( &slot->parts[part_application] )
, driverManager( &slot->parts[part_driverManager] )
, usbBus( &slot->parts[part_usbBus] )
, currentState( SPECIAL_INTERNAL_STATE_UNVISITED )
{
stateNames[top__InitUSBBus] = "top__InitUSBBus";
stateNames[top__Running] = "top__Running";
stateNames[top__WaitForResourceManager] = "top__WaitForResourceManager";
stateNames[top__InitUSBBus__WaitForPrinter] = "top__InitUSBBus__WaitForPrinter";
stateNames[top__InitUSBBus__WaitForStorage] = "top__InitUSBBus__WaitForStorage";
stateNames[top__InitUSBBus__boundary] = "top__InitUSBBus__boundary";
stateNames[SPECIAL_INTERNAL_STATE_UNVISITED] = "<uninitialized>";
int i = 0;
while( i < 1 )
history[i++] = SPECIAL_INTERNAL_STATE_UNVISITED;
}
void Capsule_Computer::bindPort( bool isBorder, int portId, int index )
{
if( isBorder )
switch( portId )
{
case borderport_usbPort:
switch( index )
{
case 0:
UMLRTFrameService::connectRelayPort( borderPorts[borderport_usbPort], index, &slot->parts[part_usbBus].slots[0]->ports[Capsule_USBDeviceDriver::borderport_usbExtPort], 0 );
UMLRTFrameService::bindSubcapsulePort( true, slot->parts[part_usbBus].slots[0]->capsule, portId, index );
break;
case 1:
UMLRTFrameService::connectRelayPort( borderPorts[borderport_usbPort], index, &slot->parts[part_usbBus].slots[1]->ports[Capsule_USBDeviceDriver::borderport_usbExtPort], 0 );
UMLRTFrameService::bindSubcapsulePort( true, slot->parts[part_usbBus].slots[1]->capsule, portId, index );
break;
}
break;
case borderport_userPort:
switch( index )
{
case 0:
UMLRTFrameService::connectRelayPort( borderPorts[borderport_userPort], index, &slot->parts[part_application].slots[0]->ports[Capsule_WordProcessorApp::borderport_UserControlePort], 0 );
UMLRTFrameService::bindSubcapsulePort( true, slot->parts[part_application].slots[0]->capsule, portId, index );
break;
}
break;
}
else
UMLRTFrameService::sendBoundUnbound( internalPorts, internalport_resMgr, index, true );
}
void Capsule_Computer::unbindPort( bool isBorder, int portId, int index )
{
if( isBorder )
switch( portId )
{
case borderport_usbPort:
switch( index )
{
case 0:
UMLRTFrameService::unbindSubcapsulePort( true, slot->parts[part_usbBus].slots[0]->capsule, portId, index );
break;
case 1:
UMLRTFrameService::unbindSubcapsulePort( true, slot->parts[part_usbBus].slots[1]->capsule, portId, index );
break;
}
break;
case borderport_userPort:
switch( index )
{
case 0:
UMLRTFrameService::unbindSubcapsulePort( true, slot->parts[part_application].slots[0]->capsule, portId, index );
break;
}
break;
}
else
{
UMLRTFrameService::sendBoundUnbound( internalPorts, internalport_resMgr, index, false );
UMLRTFrameService::disconnectPort( internalPorts[internalport_resMgr], index );
}
}
void Capsule_Computer::inject( const UMLRTMessage & message )
{
msg = &message;
switch( currentState )
{
case top__WaitForResourceManager:
currentState = state_____top__WaitForResourceManager( &message );
break;
case top__Running:
currentState = state_____top__Running( &message );
break;
case top__InitUSBBus__WaitForPrinter:
currentState = state_____top__InitUSBBus__WaitForPrinter( &message );
break;
case top__InitUSBBus__WaitForStorage:
currentState = state_____top__InitUSBBus__WaitForStorage( &message );
break;
case top__InitUSBBus__boundary:
currentState = state_____top__InitUSBBus__boundary( &message );
break;
default:
break;
}
}
void Capsule_Computer::initialize( const UMLRTMessage & message )
{
msg = &message;
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Initialise( &message );
currentState = top__WaitForResourceManager;
}
const char * Capsule_Computer::getCurrentStateString() const
{
return stateNames[currentState];
}
void Capsule_Computer::save_history( Capsule_Computer::State compositeState, Capsule_Computer::State subState )
{
history[compositeState] = subState;
}
bool Capsule_Computer::check_history( Capsule_Computer::State compositeState, Capsule_Computer::State subState )
{
return history[compositeState] == subState;
}
void Capsule_Computer::entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForPrinter__setTimer( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_4dTQAO4SEeSJPsWo_Mnp3w */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] ";
numSec = 10;
timerId = timer.informIn( UMLRTTimespec( numSec, 0 ) );
if ( timerId.isValid() ) {
std::cout << " sets a " << numSec << " seconds timer" << std::endl;
}
else {
std::cout << " FAILed to set a " << numSec << " seconds timer!" << std::endl;
}
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForStorage__requestStorageDriver( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_7xknsO4TEeSJPsWo_Mnp3w */
#define umlrtparam_resourceID ( *(const UMLRTCapsuleId * )msg->getParam( 0 ) )
#define rtdata ( (const UMLRTCapsuleId * )msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] is in state {WaitForStorage} ";
/**
* Send storage request
*/
if ( resMgr.requestStorageDriver().send() ) {
std::cout << "and requested a storage driver";
} else {
std::cout << "FAILed to request a storage driver";
}
/**
* Set timeout for storage request
*/
numSec = 10;
timerId = timer.informIn( UMLRTTimespec( numSec, 0 ) );
if ( timerId.isValid() ) {
std::cout << " set a " << numSec << " seconds timer waiting for a storageDriver." << std::endl;
}
else {
std::cout << " FAILed to set a " << numSec << " seconds timer!" << std::endl;
}
// the following code has been generated
#undef rtdata
#undef umlrtparam_resourceID
// generated code ends
}
void Capsule_Computer::entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__initUSBBus( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_E2O74A7eEeWWHqV5N_7gJQ */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] is in state {InitUSBBus}, waiting for the USB bus to be initialized." << std::endl;
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Running__running( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_Aj9CgO4dEeSJPsWo_Mnp3w */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] is in state {Running}." << std::endl;
//context()->debugOutputModel();
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__WaitForResourceManager__waitForResMgr( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_t4bf4O4OEeSAlbC0LA6o5Q */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime ;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] is in state {WaitForResourceManager}, waiting for resource manager initalization" << std::endl;
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintDriverTimeout__Timeout_NoResponse( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_ZIsvMO4TEeSJPsWo_Mnp3w */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] timed out while waiting for a printerId" << std::endl;
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintResourceID__importPrinterDriver_requestStorageDriver( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_ekrn0MbkEeSvmLj5mtpd2g */
#define umlrtparam_resourceID ( *(const UMLRTCapsuleId * )msg->getParam( 0 ) )
#define rtdata ( (const UMLRTCapsuleId * )msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] ";
if ( timer.cancelTimer( timerId ) ) {
std::cout << "timer canceled";
} else {
std::cout << "ERROR canceling timer";
}
printerID = (UMLRTCapsuleId) *rtdata;
if ( printerID.isValid() ) {
if ( frame.import( printerID, usbBus, 0) ) {
std::cout << " and successfully imported the printer driver" << std::endl;
} else {
std::cout << " and FAILed to import the printer driver" << std::endl;
}
} else {
std::cout << "[" << this->getName() << "] and received an INVALID printerID!" << std::endl;
}
// the following code has been generated
#undef rtdata
#undef umlrtparam_resourceID
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageResourceID__importStorageDriver( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_sYYgoMeGEeSz1oN1Kl4Now */
#define umlrtparam_resourceID ( *(const UMLRTCapsuleId * )msg->getParam( 0 ) )
#define rtdata ( (const UMLRTCapsuleId * )msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] ";
if ( timer.cancelTimer( timerId ) ) {
std::cout << "timer canceled";
} else {
std::cout << "ERROR canceling timer";
}
storageID = (UMLRTCapsuleId) *rtdata;
if ( storageID.isValid() ) {
if ( frame.import( storageID, usbBus, 1)) {
std::cout << " and storage is now available." << std::endl;
} else {
std::cout << " but FAILed to import storage driver!" << std::endl;
}
} else {
std::cout << "[" << this->getName() << "but received INVALID storageID!" << std::endl;
}
// the following code has been generated
#undef rtdata
#undef umlrtparam_resourceID
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageTimeout__onStorageTimeout( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_PgxWMO4UEeSJPsWo_Mnp3w */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << " timed out waiting to receive a storageId" << std::endl;
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Initialise__initializing( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_3U_ckMbgEeSvmLj5mtpd2g */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "] initializing" << std::endl;
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__onResMgrRunning__resMgrRunning( const UMLRTMessage * msg )
{
// the following code has been generated
/* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_Lk1o8O4QEeSJPsWo_Mnp3w */
#define rtdata ( (void *)msg->getParam( 0 ) )
// generated code ends
time_t currentTime;
struct tm *localTime;
time( &currentTime );
localTime = localtime( &currentTime );
std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] ";
std::cout << "[" << this->getName() << "::{resMgrRunning}] is now accepting requests ";
if ( resMgr.requestPrinterDriver().send() ) {
std::cout << " -- requesting for a printer driver." << std::endl;
} else {
std::cout << " -- FAILed to request a printer driver!" << std::endl;
}
// the following code has been generated
#undef rtdata
// generated code ends
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__EX_InitUSB_Continuation( const UMLRTMessage * msg )
{
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Running__running( msg );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__EN_initUSB_Continuation( const UMLRTMessage * msg )
{
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForPrinter__setTimer( msg );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintDriverTimeout( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintDriverTimeout__Timeout_NoResponse( msg );
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForStorage__requestStorageDriver( msg );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintResourceID( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintResourceID__importPrinterDriver_requestStorageDriver( msg );
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForStorage__requestStorageDriver( msg );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageResourceID( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageResourceID__importStorageDriver( msg );
save_history( top__InitUSBBus, top__InitUSBBus__WaitForStorage );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageTimeout( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageTimeout__onStorageTimeout( msg );
save_history( top__InitUSBBus, top__InitUSBBus__WaitForStorage );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Initialise( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__Initialise__initializing( msg );
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__WaitForResourceManager__waitForResMgr( msg );
}
void Capsule_Computer::actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__onResMgrRunning( const UMLRTMessage * msg )
{
transitionaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__onResMgrRunning__resMgrRunning( msg );
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__initUSBBus( msg );
}
void Capsule_Computer::actionchain_____top__InitUSBBus__new_transition_1( const UMLRTMessage * msg )
{
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForPrinter__setTimer( msg );
}
void Capsule_Computer::actionchain_____top__InitUSBBus__new_transition_2( const UMLRTMessage * msg )
{
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__WaitForStorage__requestStorageDriver( msg );
}
void Capsule_Computer::actionchain_____top__InitUSBBus__new_transition_3_to_boundary( const UMLRTMessage * msg )
{
entryaction_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__initUSBBus( msg );
}
Capsule_Computer::State Capsule_Computer::junction_____top__InitUSBBus__EN_initUSB( const UMLRTMessage * msg )
{
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__EN_initUSB_Continuation( msg );
return top__InitUSBBus__WaitForPrinter;
}
Capsule_Computer::State Capsule_Computer::junction_____top__InitUSBBus__EX_initUSB( const UMLRTMessage * msg )
{
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__EX_InitUSB_Continuation( msg );
return top__Running;
}
Capsule_Computer::State Capsule_Computer::choice_____top__InitUSBBus__deephistory( const UMLRTMessage * msg )
{
if( check_history( top__InitUSBBus, top__InitUSBBus__WaitForPrinter ) )
{
actionchain_____top__InitUSBBus__new_transition_1( msg );
return top__InitUSBBus__WaitForPrinter;
}
else if( check_history( top__InitUSBBus, top__InitUSBBus__WaitForStorage ) )
{
actionchain_____top__InitUSBBus__new_transition_2( msg );
return top__InitUSBBus__WaitForStorage;
}
else if( check_history( top__InitUSBBus, SPECIAL_INTERNAL_STATE_UNVISITED ) )
{
actionchain_____top__InitUSBBus__new_transition_3_to_boundary( msg );
return top__InitUSBBus__boundary;
}
return currentState;
}
Capsule_Computer::State Capsule_Computer::state_____top__InitUSBBus__WaitForPrinter( const UMLRTMessage * msg )
{
switch( msg->destPort->role()->id )
{
case port_resMgr:
switch( msg->getSignalId() )
{
case Resource::signal_resourceID:
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintResourceID( msg );
return top__InitUSBBus__WaitForStorage;
default:
this->unexpectedMessage();
break;
}
return currentState;
case port_timer:
switch( msg->getSignalId() )
{
case UMLRTTimerProtocol::signal_timeout:
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onPrintDriverTimeout( msg );
return top__InitUSBBus__WaitForStorage;
default:
this->unexpectedMessage();
break;
}
return currentState;
default:
this->unexpectedMessage();
break;
}
return currentState;
}
Capsule_Computer::State Capsule_Computer::state_____top__InitUSBBus__WaitForStorage( const UMLRTMessage * msg )
{
switch( msg->destPort->role()->id )
{
case port_resMgr:
switch( msg->getSignalId() )
{
case Resource::signal_resourceID:
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__InitUSBBus__Region1__onStorageResourceID( msg );
return junction_____top__InitUSBBus__EX_initUSB( msg );
default:
this->unexpectedMessage();
break;
}
return currentState;
default:
this->unexpectedMessage();
break;
}
return currentState;
}
Capsule_Computer::State Capsule_Computer::state_____top__InitUSBBus__boundary( const UMLRTMessage * msg )
{
switch( msg->destPort->role()->id )
{
default:
this->unexpectedMessage();
break;
}
return currentState;
}
Capsule_Computer::State Capsule_Computer::state_____top__Running( const UMLRTMessage * msg )
{
switch( msg->destPort->role()->id )
{
default:
this->unexpectedMessage();
break;
}
return currentState;
}
Capsule_Computer::State Capsule_Computer::state_____top__WaitForResourceManager( const UMLRTMessage * msg )
{
switch( msg->destPort->role()->id )
{
case port_resMgr:
switch( msg->getSignalId() )
{
case Resource::signal_resMgrRunning:
actionchain_____action_____ComputerSystem__Computer__Computer__Computer_SM__Region1__onResMgrRunning( msg );
return junction_____top__InitUSBBus__EN_initUSB( msg );
default:
this->unexpectedMessage();
break;
}
return currentState;
default:
this->unexpectedMessage();
break;
}
return currentState;
}
static const UMLRTCapsuleRole roles[] =
{
{
"application",
&WordProcessorApp,
1,
1,
false,
false
},
{
"driverManager",
&ResourceManager,
1,
1,
false,
false
},
{
"usbBus",
&USBDeviceDriver,
0,
2,
false,
true
}
};
static const UMLRTCommsPortRole portroles_border[] =
{
{
Capsule_Computer::port_frame,
"Frame",
"frame",
"",
1,
true,
false,
false,
false,
false,
false,
false
},
{
Capsule_Computer::port_timer,
"Timing",
"timer",
"",
1,
true,
false,
false,
false,
false,
false,
false
},
{
Capsule_Computer::port_usbPort,
"USBProtocol",
"usbPort",
"",
2,
true,
true,
false,
false,
false,
false,
true
},
{
Capsule_Computer::port_userPort,
"AppControl",
"userPort",
"",
1,
true,
false,
false,
true,
false,
false,
true
}
};
static const UMLRTCommsPortRole portroles_internal[] =
{
{
Capsule_Computer::port_resMgr,
"Resource",
"resMgr",
"",
1,
true,
true,
false,
false,
false,
false,
true
}
};
static void instantiate_Computer( const UMLRTRtsInterface * rts, UMLRTSlot * slot, const UMLRTCommsPort * * borderPorts )
{
const UMLRTCommsPort * * internalPorts = UMLRTFrameService::createInternalPorts( slot, &Computer );
UMLRTFrameService::connectPorts( internalPorts[Capsule_Computer::internalport_resMgr], 0, &slot->parts[Capsule_Computer::part_driverManager].slots[0]->ports[Capsule_ResourceManager::borderport_resMgr], 0 );
UMLRTFrameService::connectRelayPort( borderPorts[Capsule_Computer::borderport_usbPort], 0, &slot->parts[Capsule_Computer::part_usbBus].slots[0]->ports[Capsule_USBDeviceDriver::borderport_usbExtPort], 0 );
UMLRTFrameService::connectRelayPort( borderPorts[Capsule_Computer::borderport_usbPort], 1, &slot->parts[Capsule_Computer::part_usbBus].slots[1]->ports[Capsule_USBDeviceDriver::borderport_usbExtPort], 0 );
UMLRTFrameService::connectRelayPort( borderPorts[Capsule_Computer::borderport_userPort], 0, &slot->parts[Capsule_Computer::part_application].slots[0]->ports[Capsule_WordProcessorApp::borderport_UserControlePort], 0 );
UMLRTFrameService::connectPorts( &slot->parts[Capsule_Computer::part_application].slots[0]->ports[Capsule_WordProcessorApp::borderport_resourcePort], 0, &slot->parts[Capsule_Computer::part_driverManager].slots[0]->ports[Capsule_ResourceManager::borderport_appPort], 0 );
WordProcessorApp.instantiate( NULL, slot->parts[Capsule_Computer::part_application].slots[0], UMLRTFrameService::createBorderPorts( slot->parts[Capsule_Computer::part_application].slots[0], WordProcessorApp.numPortRolesBorder ) );
ResourceManager.instantiate( NULL, slot->parts[Capsule_Computer::part_driverManager].slots[0], UMLRTFrameService::createBorderPorts( slot->parts[Capsule_Computer::part_driverManager].slots[0], ResourceManager.numPortRolesBorder ) );
slot->capsule = new Capsule_Computer( &Computer, slot, borderPorts, internalPorts, false );
}
const UMLRTCapsuleClass Computer =
{
"Computer",
NULL,
instantiate_Computer,
3,
roles,
4,
portroles_border,
1,
portroles_internal
};