One button, two functionalities through XBee

Hi guys! I hope this is the right place to upload my programming concern.

I have been using two XBees and two Arduino boards to make them communicate with each other wirelessly.

Currently, I am using Andrew Rapp's library, "XBee.h" to make the XBee modules to communicate with each other. I have a Switch set up on a transmitter side, connected to DIO12 on the XBee. I want the Switch to have two functionalities:

  1. When I click it, it changes the Switch mode (for instance, let's say that the variable switchMode is assigned as 1 when I clicked on it). When switchMode == 1, the LED on the other Arduino board turns on. Then if I click it once more, the Switch mode, switchMode changes to 0 and the LED shuts down. If I click it once more, it changes back to 1, turns on the LED, and so on. The Switch doesn't care if I am pressing it for a long time; I must release it press it again. I was able to successfully program this first functionality. However...

  2. I have a problem with this one. Under a different condition, I want this same Switch to react to a press. Different from the first functionality where it didn't care if I pressed it for a while, I want the LED to light up only while I press on the Switch. Then if I release it, the LED would shut down.

How could I use Andrew Rapp's library, "XBee.h" to solve this problem? Right now, I tried to create a new instance of
"xbee.getResponse.getZBRxIoSampleResponse(ZBioSample)" and
"switch = !ZBioSample.isDigitalOn(switchList[3])"

but I just cannot seem to find a solution. I would appreciate your thoughts on this. If you have more questions please ask me.

xbee.getResponse().getZBRxIoSampleResponse(ZBioSample1);
xbee.getResponse().getZBRxIoSampleResponse(ZBioSample2);
switchFunc1 = !ZBioSample1.isDigitalOn(12);
switchFunc2 = !ZBioSample2.isDigitalOn(12);

This is how it looks, but it seems to just ignore ZBioSample2 and switchFunc2.