The plane acts as an AWACS for customs & border control.
It is used to hunt for go-faster smuggling boats & other ships & planes used for all forms of trafficking (guns, drugs, people etc).
Having spotted & tracked the bad guys it then acts as command & control guiding CG cutters, navy ships, helos & planes to intercept & arrest the bad guys.
The equipment on board is broadly similar to the navy E-2 Hawkeye.