Making a smart Battery

Has anyone ever tried making a smart battery controller which interfaces with CUBE?
Like how would the battery tell cube things like current,voltage,state of charge,etc so essentially how would the smart battery communicate with CUBE? Mavlink? or I2c or CAN bus ports on the carrier board? or reassigning the AUX pins as GPIOS and then using some serial protocol to get all this data and trigger RTL or make similar actions based on this data
I really have no leads on where to start looking into this. And will i need to change the code of ardpilot to do so? Any help is appreciated
oh and should i also post this on ardupilot forums? any place where i could get help regarding this