The requirements for batteries are very similar in nearly all computers and other mobile devices. For this reason, the manufacturers of computers and batteries have agreed on an industry standard how a battery unit monitors itself and how data and commands are transferred between computer, battery and charging device. The result is the Smart Battery Data Specification introduced in 1995.
Nearly all vendors of personal computers use batteries today which are compliant with the Smart Battery standard. This includes Apple computers with Intel processors. The charge processor in the battery unit is linked to the computer by a special data line, parallel to the power supply lines. This way, the computer can read operational data from the battery.