def value(startH,startM,stopH,stopM):
def job():
do job
def job1():
do another job
start_time = "{0:02d}:{1:02d}".format(startH, startM)
stop_time = "{0:02d}:{1:02d}".format(stopH, stopM)
schedule.every().day.at(start_time).do(job)
schedule.every().day.at(stop_time).do(job1)
while True:
schedule.run_pending()
time.sleep(1)
Here startH, startM, stopH,stopM means starting hour,starting minute, stopping hour, and stopping minute. which is the input given by the user through android. This code runs. It runs onces and then it keeps running. Here is the suitation. If i want the user to input the time again. It wont accept. How can accept the input from the user while the loop is still running?lets just say the first task says to turn on the light then the second task is turning off the light. So when second task is done. It is assumed as complete.I tried using break, return. It does not work as it is supposed to.
public void publish(int startH,int startM, int stopH, int stopM )
{
JSONObject js = new JSONObject();
try {
js.put("START_HOUR", startH);
js.put("START_MINUTE", startM);
js.put("STOP_HOUR", stopH);
js.put("STOP_MINUTE", stopM);
}
public void setTime(View view)
{
int storeStartHour = Integer.parseInt(startHrs.getText().toString());
int storeStartMinutes = Integer.parseInt(startMinutes.getText().toString());
int storeStopHour = Integer.parseInt(stopHrs.getText().toString());
int storeStopMinutes = Integer.parseInt(stopMinutes.getText().toString());
publish(storeStartHour, storeStartMinutes, storeStopHour, storeStopMinutes);
}
public void publish(int startH,int startM, int stopH, int stopM ) { JSONObject js = new JSONObject(); try { js.put("START_HOUR", startH); js.put("START_MINUTE", startM); js.put("STOP_HOUR", stopH); js.put("STOP_MINUTE", stopM); }the message is sent in json