I own a DCS-5222L camera and I do use the D/O ports. My practical use is to open my garage door. Here is what you need to understand. There are four pins and the ones marked I- and I+, is actually the input ports to connect an external IR sensor. I.e. The external sensor can detect motion and the camera starts recording.
The O- and O+ means Output and it is like a small switch for low voltage equipment. You could light up a small 12v lamp for example. Now, for the garage switch. When you press your garage normal switch, it actually sends a small current to your main garage unit, telling it to open or close. You can connect a cable in parallel to the existing garage switch into the two pins O- and O+. Then in your Dlink mobile app or DLink Camera portal, you just select "trigger I/O port". The o- and o+ just short, and that send a command to open or close the garage door.
Take note that standard garage door switch work on a toggle mode and you would actually need a 3rd party app to PULSE the signal. If you maintain the connection, your door will start to open and stop.