return 0;
}
+/* XXX lookup table */
+static char *cream_states[EDG_WLL_NUMBER_OF_CREAM_STATES];
+
+static int stringToCreamStat(char *s) {
+ int i;
+ for (i=0; i<EDG_WLL_NUMBER_OF_CREAM_STATES && strcmp(s,cream_states[i]); i++);
+
+ return i==EDG_WLL_NUMBER_OF_CREAM_STATES ? -1 : i;
+}
+
// XXX move this defines into some common place to be reusable
#define USABLE(res) ((res) == RET_OK)
edg_wll_JobStatCode old_state = js->pub.state;
int res = RET_OK;
+ if (!cream_states[0]) {
+ int i;
+ for (i=0; i<EDG_WLL_NUMBER_OF_CREAM_STATES; i++)
+ cream_states[i] = edg_wll_CreamStatToString(i);
+ }
/* not used in CREAM
if ((js->last_seqcode != NULL) &&
}
break;
case EDG_WLL_EVENT_CREAMCALL:
- if (USABLE(res)) {
- // BLAH -> LRMS
- if (e->any.source == EDG_WLL_SOURCE_CREAM_EXECUTOR && e->CREAMCall.callee == EDG_WLL_SOURCE_LRMS) {
- js->pub.state = EDG_WLL_JOB_SCHEDULED;
- js->pub.cream_state = EDG_WLL_STAT_IDLE;
+ if (e->any.source == EDG_WLL_SOURCE_CREAM_EXECUTOR &&
+ e->CREAMCall.callee == EDG_WLL_SOURCE_LRMS &&
+ e->CREAMCall.command == EDG_WLL_CREAM_CMD_START &&
+ e->CREAMCall.result == EDG_WLL_CREAMCALL_OK)
+ {
+ if (USABLE(res)) {
+ // BLAH -> LRMS
+ js->pub.state = EDG_WLL_JOB_SCHEDULED;
+ js->pub.cream_state = EDG_WLL_STAT_IDLE;
+ }
+
+ if (USABLE_DATA(res)) {
+ rep(js->pub.cream_reason, e->CREAMCall.reason);
}
-
- }
- if (USABLE_DATA(res)) {
- rep(js->pub.cream_reason, e->CREAMCall.reason);
}
break;
+/* not used, replaced by CREAMSTATUS */
+#if 0
case EDG_WLL_EVENT_CREAMRUNNING:
if (USABLE(res)) {
js->pub.state = EDG_WLL_JOB_RUNNING;
rep(js->pub.cream_reason, e->CREAMDone.reason);
}
break;
+#endif
+
case EDG_WLL_EVENT_CREAMCANCEL:
if (USABLE(res)) {
if (e->CREAMCancel.status_code == EDG_WLL_CANCEL_DONE) {
}
break;
+ case EDG_WLL_EVENT_CREAMSTATUS:
+ if (USABLE(res) && e->CREAMStatus.result == EDG_WLL_CREAMSTATUS_DONE)
+ {
+ switch (js->pub.cream_state = stringToCreamStat(e->CREAMStatus.new_state))
+ {
+ /* XXX: should not arrive */
+ case EDG_WLL_STAT_REGISTERED:
+ case EDG_WLL_NUMBER_OF_CREAM_STATES:
+ break;
+
+ case EDG_WLL_STAT_PENDING: js->pub.state = EDG_WLL_JOB_WAITING; break;
+ case EDG_WLL_STAT_IDLE: js->pub.state = EDG_WLL_JOB_SCHEDULED; break;
+ case EDG_WLL_STAT_RUNNING:
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ js->pub.jw_status = EDG_WLL_STAT_WRAPPER_RUNNING;
+ break;
+ case EDG_WLL_STAT_REALLYRUNNING:
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ js->pub.jw_status = EDG_WLL_STAT_PAYLOAD_RUNNING;
+ break;
+ case EDG_WLL_STAT_HELD: /* TODO */ break;
+ case EDG_WLL_STAT_DONEOK:
+ js->pub.state = EDG_WLL_JOB_DONE;
+ js->pub.done_code = EDG_WLL_STAT_OK;
+ break;
+ case EDG_WLL_STAT_DONEFAILED:
+ js->pub.state = EDG_WLL_JOB_DONE;
+ js->pub.done_code = EDG_WLL_STAT_FAILED;
+ break;
+ case EDG_WLL_STAT_ABORTED: js->pub.state = EDG_WLL_JOB_ABORTED; break;
+ }
+ }
+ break;
+
case EDG_WLL_EVENT_USERTAG:
if (USABLE_DATA(res)) {
if (e->userTag.name != NULL && e->userTag.value != NULL) {