CPAP machines are supposed to be removed and presented to an Officer. That's for your own protection as the instructions for most warn against sending through X-Ray.
TSA-"approved" locks aren't for hand luggage, they are for checked luggage.
The Officer was helping you out. Hope the machine not harmed.