Skip to content
Snippets Groups Projects

Ahmeda

Closed Ludovic Apvrille requested to merge ahmeda into master
18 files
+ 7910
7602
Compare changes
  • Side-by-side
  • Inline
Files
18
+ 80
0
#include "Color.h"
// Header code defined in the model
void __userImplemented__Color__initt(){
init_sensor();
}
int __userImplemented__Color__checkColor(){
return measure_color();
}
// End of header code defined in the model
#define STATE__START__STATE 0
#define STATE__WAIT_FOR_READY 1
#define STATE__STOP__STATE 2
void Color__initt() {
traceFunctionCall("Color", "initt", "-");
__userImplemented__Color__initt();
}
int Color__checkColor() {
traceFunctionCall("Color", "checkColor", "-");
return __userImplemented__Color__checkColor();
}
void *mainFunc__Color(void *arg){
int color = 0;
int __currentState = STATE__START__STATE;
__attribute__((unused)) request __req0;
__attribute__((unused))int *__params0[1];
__attribute__((unused))setOfRequests __list;
__attribute__((unused))pthread_cond_t __myCond;
__attribute__((unused))request *__returnRequest;
char * __myname = (char *)arg;
pthread_cond_init(&__myCond, NULL);
fillListOfRequests(&__list, __myname, &__myCond, &__mainMutex);
//printf("my name = %s\n", __myname);
/* Main loop on states */
while(__currentState != STATE__STOP__STATE) {
switch(__currentState) {
case STATE__START__STATE:
traceStateEntering(__myname, "__StartState");
Color__initt();
__currentState = STATE__WAIT_FOR_READY;
break;
case STATE__WAIT_FOR_READY:
traceStateEntering(__myname, "WAIT_FOR_READY");
makeNewRequest(&__req0, 2131, RECEIVE_SYNC_REQUEST, 0, 0, 0, 0, __params0);
__req0.syncChannel = &__Color_ready_to_receive__Controller_ready_to_receive_color;
__returnRequest = executeOneRequest(&__list, &__req0);
clearListOfRequests(&__list);
traceRequest(__myname, __returnRequest);
color = Color__checkColor();
traceVariableModification("Color", "color", color,0);
__params0[0] = &color;
makeNewRequest(&__req0, 2132, SEND_SYNC_REQUEST, 0, 0, 0, 1, __params0);
__req0.syncChannel = &__Color_sendColor__Controller_receiveColor;
__returnRequest = executeOneRequest(&__list, &__req0);
clearListOfRequests(&__list);
traceRequest(__myname, __returnRequest);
__currentState = STATE__WAIT_FOR_READY;
break;
}
}
//printf("Exiting = %s\n", __myname);
return NULL;
}
Loading