To make the peripheral device advertise for 30sec, you can change the timeout value in the BLE component customiser to 30 secs. Initially, the device will be in disconnected state. On switch press, an interrupt will be triggered which will make the peripheral device start connectable advertisement for 30 secs. If the device is in connected state and switch is pressed, then the device will be disconnected first and then start connectable advertisement again for 30 secs.
I am attaching the project for your reference.
SW_ADV.cyprj.Archive01.zip 816.3 K