#!/bin/bash
. /home/ROULETTE/common.config #here is configuration of ROULETTE and FC5 locations

#if another instance of this iscrpt is already running, exit
#for pid in $(pidof -x $0); do
#    if [ $pid != $$ ]; then
#        echo "[$(date)] : $0 : Process is already running with PID $pid"
#        exit 1
#    fi
#done

ROULETTE=/home/ROULETTE

echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'PLAYBACK_VOLUME', '', '', 11, NULL, '50');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'MUSIC_VOLUME', '', '', 11, NULL, '10');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'PLAYAWAY_ENABLED', '', '', 11, NULL, '0');"|/home/ROULETTE/sqlexec.sh

echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'EXPERIMENTAL_FEATURES', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh

echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_ILLUMINATION_MAX_PWM', '', '', 11, NULL, '128');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_SEMAPHORE_MAX_PWM', '', '', 11, NULL, '230');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_BUTTON_LIGHTS_MAX_PWM', '', '', 11, NULL, '179');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'SEMAPHORE_TYPE', '', '', 11, NULL, 'RGB');"|/home/ROULETTE/sqlexec.sh

#obsolete
#echo "select * from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'TOP_BACKGROUND_SHADER', NULL, NULL, 11, NULL, 'Animation/shader_godrays.json')" | $ROULETTE/sqlexec.sh
#echo "select * from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'BACKGROUND_SHADER', NULL, NULL, 11, NULL, 'Animation/shader_bubbles.json')" | $ROULETTE/sqlexec.sh

#DOOR Switches on terminals
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_BIG_DOOR_OPEN', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_SMALL_DOOR_OPEN', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_LOGIC_DOOR_OPEN', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_DEPOSIT_BOX_DOOR_OPEN', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh

#KEY_RIGHTS - for AGRO default
#1056768 -NO UID, over other hardware
#echo "select RESULT from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'CLOSE_ADMIN_MENU_ON_KEY_OUT', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'ADMIN_KEY_TYPE', '', '', 11, NULL, '0');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_DESC', '', '', 11, NULL, 'Master Key');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_CODE', '', '', 11, NULL, '85-85-33-141-230-60');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_RIGHTS', '', '', 11, NULL, 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_DESC', '', '', 11, NULL, 'Audit');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_CODE', '', '', 11, NULL, '142-227-192-8-239-125');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_RIGHTS', '', '', 11, NULL, 'nnyyyyynyynynnyynyyynnnnnnnynnnnnnyynnnnnnnnnnnnn');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_DESC', '', '', 11, NULL, 'Attendant');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_CODE', '', '', 11, NULL, '199-113-96-132-247-190');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_RIGHTS', '', '', 11, NULL, 'nyyyynnnyynynnyynynnnnnnnnnynnnnnnyynnnnnnnnnnnnn');"|/home/ROULETTE/sqlexec.sh
#echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh


#single zero - 36
#double zero - 18
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'IS_DOUBLE_ZERO', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh #sem dal v jurisdictional preset!
echo "select result from SET_PARAM('WHEEL', 'UPDATE', 'ZERO_NUMBER_OFFSET', '', '', 11, 18, '18');" | $ROULETTE/sqlexec.sh

#short GAME_DURATION
echo "select result from SET_PARAM('WHEEL','UPDATE','GAME_TIME',NULL,NULL,11,30,'30');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','GAME_TIME_RANDOM',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BET_PLACED_TIME',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BET_PLACED_TIME_RANDOM',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','WARN_BEFORE_GAME_TIME_ELAPSES',NULL,NULL,11,7,'7');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BETS_OPEN_MODE',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BALL_OUT_TIME',NULL,NULL,11,7,'7');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE','SEARCH_FOR_BALL_IGNORES',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','STOP_GAME_IF_BALL_LAPS_COUNT_ERROR',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','STOP_GAME_IF_WIN_KNOWN_WHILE_BETS_OPEN',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_ON_WHEEL_SPEED_ERROR', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_BALL_LOST_ERROR_OK',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_BALL_OUT_TIMEOUT',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_BALL_SPEED_ERROR',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_CAN_NOT_READ_WIN_NUMBER_ERROR',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_COUPOLA_OPEN_ERROR',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_DOOR_OPEN_ERROR',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_LAPS_COUNT_ERROR',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_WHEEL_SPEED_ERROR',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','REBLOW_IF_WIN_NUMBER_K_W_BO',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE', 'MCNT_CENTRAL_ENABLE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'DONGLE_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_IF_COUPOLA_OPEN', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_IF_BIG_DOOR_OPEN', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_IF_SMALL_DOOR_OPEN', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_IF_LOGIC_DOOR_OPEN', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE', 'STOP_GAME_IF_DEPOSIT_BOX_DOOR_OPEN', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE','BLOW_TIMES_PRESET',NULL,NULL,11,0,'0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BLOW_TIME_0_MAX',NULL,NULL,11,2300,'2300');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','BLOW_TIME_0_MIN',NULL,NULL,11,1200,'1200');" | $ROULETTE/sqlexec.sh

echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_BETS_OPEN_1',NULL,NULL,11,1,'1');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_BETS_CLOSING',NULL,NULL,11,14,'14');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_READ_WIN_1',NULL,NULL,11,9,'9');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_READ_WIN_2',NULL,NULL,11,3,'3');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_READ_WIN_3',NULL,NULL,11,3,'3');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_GAME_FINISHED',NULL,NULL,11,9,'9');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_GAME_FINISHED',NULL,NULL,11,9,'9');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('WHEEL','UPDATE','MOTOR_SPEED_SEARCH_FOR_BALL',NULL,NULL,11,9,'9');" | $ROULETTE/sqlexec.sh

#hardware config
#BSTN RFID
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'ADMIN_KEY_TYPE', '', '', 11, 0, '1081344');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'ADMIN_KEY_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh
#auto close menu enabled when using RFID
echo "select result from SET_PARAM('PLATFORM', 'UPDATE', 'CLOSE_ADMIN_MENU_ON_KEY_OUT', '', '', 11, 1, '1');" | $ROULETTE/sqlexec.sh

#coins disabled
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'COIN_SYS_TYPE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'COIN_SYS_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh

#IGPV6 board
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'IOBOARD_TYPE', '', '', 11, 0, '8396800');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'IOBOARD_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh

#USB touch - port is ignored
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'TOUCH_TYPE', '', '', 11, 0, '98304');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'TOUCH_PORT', '', '', 11, 0, '/dev/ttyNOUSE');" | $ROULETTE/sqlexec.sh

#JCM - 266240
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'BILL_ACC_TYPE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'BILL_ACC_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh

#GEN5 - 4210688
#GEN2 - 4202496
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'TICKET_TYPE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'TICKET_PORT', '', '', 11, 0, 'IGPLATFORMV6');" | $ROULETTE/sqlexec.sh

#keyboard disabled
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'KEYBOARD_TYPE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'KEYBOARD_PORT', '', '', 11, 0, 'AUTO');" | $ROULETTE/sqlexec.sh

#SAS 6.02 - 2101248
#SAS 6.03 - 2105344
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'ONLINE_SYSTEM_TYPE', '', '', 11, 0, '0');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'ONLINE_SYSTEM_PORT', '', '', 11, 0, 'IGPLATFORMV6');" | $ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'UPDATE', 'SAS_CASHOUT_PRIORITY', '', '', 11, 0, 'TICKET');" | $ROULETTE/sqlexec.sh
