The assault is specifically to torment Jim Gordon, not a random act of violence (as far as all of the Joker's actions are random acts of violence), but it's just done to prove his point.
Spoilered due to content:
The plot revolves around the Joker's plan to make a point, that any normal person could go insane after just one bad day. He targets Commissioner Gordon as that normal person, as a bastion of good and lawful.
I've proved my point. Gordon's been driven mad.
I've demonstrated there's no difference between me and everyone else. All it takes is one bad day. That's how far the world is from where I am, just one bad day.
The source material phrases it slightly different:
All it takes is one bad day to reduce the sanest man alive to lunacy.
In that both Batman and the Joker see Gordon as the sanest man in Gotham.
He fails though, after sexually assaulting Barbara and forcing Gordon to watch on screen. Batman's response:
I spoke with Commissioner Gordon before I came in here. He told me he wanted this done by the book. You know what that means? It means that despite all your sick, cruel, vicious little games, he's as sane as he ever was.
So, ordinary people don't crack. Maybe it's just you.
As far as it being a message to Batman, isn't everything the Joker does a message to Batman? Philosophical question aside, not really. Neither the Joker or Jim know that Barbara is Batgirl. As far as the Joker knows, she's no one specific to Batman other than a random civilian. Attacking Barbara was just a means to an end to him. The point was that the Joker isn't just some nutcase, that he's normal as anyone else pushed to the end. The closest this comes to being about Batman is part of the monologue above:
You had a bad day once, am I right? Oh, I know I am. I can tell. You had a bad day and everything changed. Dressing up like a flying rat doesn't hide it, it screams it. You had a bad day and it drove you as crazy as everybody else, only you won't admit it.