Exemple #1
0
static int status_callback(long param, void *ptr)
{
  const quvi_word status = quvi_loword(param);
  const quvi_word type   = quvi_hiword(param);

  switch (status)
    {
    case QUVISTATUS_FETCH :
      handle_fetch(type,ptr);
      break;
    case QUVISTATUS_VERIFY:
      handle_verify(type);
      break;
    case QUVISTATUS_RESOLVE:
      handle_resolve(type);
      break;
    }

  cc::log << std::flush;

  return QUVI_OK;
}
void ui_process(void * pvParameters)
{

    status info;

    char stat=2;

    portBASE_TYPE receive_status;


    ui_init();


    while(1) {
        receive_status=xQueueReceive(queue_button,&info,portMAX_DELAY);
        vTaskDelay( ( 500 / portTICK_RATE_MS ) );
        if(receive_status==pdTRUE) { //
#ifdef debug
            printf("receive ok \r\n");
#endif
            switch (info.opera) {
            case yesic: {
                handle_ic(&info);
                break;
            }

            case verify: {
#ifdef debug
                printf("prepare for process verify\r\n");
#endif
                handle_verify();
                break;
            }
            case startcharging: {
#ifdef debug
                printf("start charing\r\n");
#endif
                handle_charging(&info);

                break;


            }
            case ensure: {
#ifdef debug
                printf("start ensure\r\n");
#endif
                //  if(0==handle_ensure(info.id,100))   //验证通过,停止充电

                if(portL==info.port) {

#ifdef debug
                    printf("ensure L\r\n");
#endif
                    stat=handle_ensure(PORTL.id,100);
                    if(0==stat) {

#ifdef debug
                        printf("stop L\r\n");
#endif
                        PORTL.status=available;
                        
                        stopL.stop=stopnone;
                        
                        P1G(0);//关闭相应的充电指示灯


//在此添加处理函数停止充电的处理函数,包括继电器和扣费
                        AC1_poweroff();
                        ensure2ensureok();

                        vTaskDelay( ( 3000 / portTICK_RATE_MS ) );

                        ensureok2welcome0();
                        //stop

                    } else

                    {

                        ensure2ensureok();
                        change_ensureoktext("请刷会员卡或者您不是该端口的当前用户,请您自觉遵守充电秩序 ");
                        vTaskDelay( ( 3000 / portTICK_RATE_MS ) );
                        ensureok2welcome0();

                    }


                }

                else if(portR==info.port) {
#ifdef debug
                    printf("ensure R\r\n");
#endif

                    stat=handle_ensure(PORTR.id,100);
                    if(0==stat) {
#ifdef debug
                        printf("stop R\r\n");
#endif

                        PORTR.status=available;
                        
                        stopR.stop=stopnone;
                        
                        P2G(0);//关闭相应的充电指示灯
//在此添加处理函数停止充电的处理函数,包括继电器和扣费
                        //stop
                        AC2_poweroff();

                        ensure2ensureok();

                        vTaskDelay( ( 3000 / portTICK_RATE_MS ) );

                        ensureok2welcome0();
                    }

                    else {
                        ensure2ensureok();
                        change_ensureoktext("请刷会员卡或者您不是该端口的当前用户,请您自觉遵守充电秩序 ");
                        vTaskDelay( ( 3000 / portTICK_RATE_MS ) );
                        ensureok2welcome0();

                    }

                }

                break;
            }

            default : {
                break;
            }

            }

        }
    }

}