Skip to content
Snippets Groups Projects

Ahmeda

Closed Ludovic Apvrille requested to merge ahmeda into master
8 files
+ 2486
2477
Compare changes
  • Side-by-side
  • Inline
Files
8
+ 76
0
#include "Color.h"
// Header code defined in the model
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
int Color__checkColor() {
traceFunctionCall("Color", "checkColor", "-");
return __userImplemented__Color__checkColor();
}
void Color__waitt(int distance, int speed, int factor) {
char my__attr[CHAR_ALLOC_SIZE];
sprintf(my__attr, "%d,%d,%d",distance,speed,factor);
traceFunctionCall("Color", "waitt", my__attr);
}
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");
__currentState = STATE__WAIT_FOR_READY;
break;
case STATE__WAIT_FOR_READY:
traceStateEntering(__myname, "WAIT_FOR_READY");
makeNewRequest(&__req0, 13508, RECEIVE_SYNC_REQUEST, 0, 0, 0, 0, __params0);
__req0.syncChannel = &__Color_ready_to_receive__Data_Collector_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, 13509, SEND_SYNC_REQUEST, 0, 0, 0, 1, __params0);
__req0.syncChannel = &__Color_sendColor__Data_Collector_receive_color;
__returnRequest = executeOneRequest(&__list, &__req0);
clearListOfRequests(&__list);
traceRequest(__myname, __returnRequest);
__currentState = STATE__WAIT_FOR_READY;
break;
}
}
//printf("Exiting = %s\n", __myname);
return NULL;
}
Loading