1661 |
1661 |
1662 } else if (val && (strcmp(kwd, (char *)"PROF_STATE") == 0)) { |
1662 } else if (val && (strcmp(kwd, (char *)"PROF_STATE") == 0)) { |
1663 for (i = 0; i < 5; i++) { |
1663 for (i = 0; i < 5; i++) { |
1664 if (strcmp(val, PROFSTATE[i]) == 0) { |
1664 if (strcmp(val, PROFSTATE[i]) == 0) { |
1665 switch (i) { |
1665 switch (i) { |
1666 case PROFILE_OFF: if (unit->prof_state == PROFILE_DONE) |
1666 case PROFILE_OFF: if (unit->prof_state == PROFILE_DONE) { |
1667 unit->prof_state = PROFILE_OFF; |
1667 unit->prof_state = PROFILE_OFF; |
|
1668 syslog(LOG_NOTICE, "Profile to OFF via web interface"); |
|
1669 } |
1668 break; |
1670 break; |
1669 case PROFILE_PAUSE: if (unit->prof_state == PROFILE_RUN) |
1671 case PROFILE_PAUSE: if (unit->prof_state == PROFILE_RUN) { |
1670 unit->prof_state = PROFILE_PAUSE; |
1672 unit->prof_state = PROFILE_PAUSE; |
1671 else if (unit->prof_state == PROFILE_PAUSE) |
1673 syslog(LOG_NOTICE, "Profile PAUSE via web interface"); |
|
1674 } else if (unit->prof_state == PROFILE_PAUSE) { |
1672 unit->prof_state = PROFILE_RUN; |
1675 unit->prof_state = PROFILE_RUN; |
|
1676 syslog(LOG_NOTICE, "Profile RESUME via web interface"); |
|
1677 } |
1673 break; |
1678 break; |
1674 case PROFILE_RUN: if (unit->prof_state == PROFILE_OFF) { |
1679 case PROFILE_RUN: if (unit->prof_state == PROFILE_OFF) { |
1675 unit->prof_state = PROFILE_RUN; |
1680 unit->prof_state = PROFILE_RUN; |
1676 unit->prof_started = time(NULL); |
1681 unit->prof_started = time(NULL); |
1677 unit->prof_paused = 0; |
1682 unit->prof_paused = 0; |
|
1683 syslog(LOG_NOTICE, "Profile to RUN via web interface"); |
1678 } |
1684 } |
1679 break; |
1685 break; |
1680 case PROFILE_DONE: break; /* Command is illegal */ |
1686 case PROFILE_DONE: break; /* Command is illegal */ |
1681 case PROFILE_ABORT: if ((unit->prof_state == PROFILE_RUN) || (unit->prof_state == PROFILE_PAUSE)) { |
1687 case PROFILE_ABORT: if ((unit->prof_state == PROFILE_RUN) || (unit->prof_state == PROFILE_PAUSE)) { |
1682 unit->prof_state = PROFILE_OFF; |
1688 unit->prof_state = PROFILE_OFF; |
1683 unit->prof_started = 0; |
1689 unit->prof_started = 0; |
|
1690 syslog(LOG_NOTICE, "Profile ABORT via web interface"); |
1684 } |
1691 } |
1685 break; |
1692 break; |
1686 } |
1693 } |
1687 break; |
1694 break; |
1688 } |
1695 } |