The horn may only be used to attract other road users' attention if needed to avert a dangerous situation. For example, if you suspect a pedestrian has not seen your car and is heading out into the street.
You may not use the horn to greet another road user or to indicate your annoyance at someone's way of driving.