Be sure to record the encounter, if the disarming is at odds with state law get a judge to say that to that cop. A cop who decides to disarm you at that time believes that he has the authority to do so as a result of the officer safety canard. Every now and then a cop will verbalize the reason for disarming is to check the serial number. Most cops are likely far more savvy these days. Officer safety is the reason and it will be the rare judge to dispute that cops claim. You may receive a redress of wrongs, later, but you are very very unlikely to prevent the seizure on the sidewalk.
Do nothing to prevent a cop from disarming you.