Mer/Documentation/BME Protocol: Difference between revisions

From Maemo Wiki
Jump to navigationJump to search
New page: This documentation is entirely for the purpose of implementing software gathering battery information, not alteration of battery management state. General protocol, published https://gara...
 
No edit summary
Line 1: Line 1:
This documentation is entirely for the purpose of implementing software gathering battery information, not alteration of battery management state.
This documentation is entirely for the purpose of implementing software gathering battery information on Nokia Internet Tablets, not alteration of battery management state.  


General protocol, published https://garage.maemo.org/plugins/scmsvn/viewcvs.php/dsme/trunk/adhoc/dummy_bme.c?revision=155&root=dsm&view=markup , released as LGPL 2.1
General protocol, published https://garage.maemo.org/plugins/scmsvn/viewcvs.php/dsme/trunk/adhoc/dummy_bme.c?revision=155&root=dsm&view=markup , released as LGPL 2.1
Line 7: Line 7:
* Server: send('\n')
* Server: send('\n')


From then on:
After handshake:


<code>
<pre>
typedef struct {
typedef struct {
     uint16      type, subtype;
     uint16      type, subtype;
} BMEHeader;
} BMEHeader;
</code>
</pre>


types so far (NAME, (type, subtype)):
types so far (NAME, (type, subtype)):
Line 19: Line 19:
== EM_BATTERY_INFO_REQ (0x06, 0x00) ==
== EM_BATTERY_INFO_REQ (0x06, 0x00) ==


<code>
<pre>
typedef struct {
typedef struct {
     BMEHeader header;
     BMEHeader header;
     u_int32_t flags;       ''Set to 0xFFFFFFFF to get all contents''
     u_int32_t flags;   // Set to 0xFFFFFFFF to get all data
} BME_EM_BATTERY_INFO_Req;
} BME_EM_BATTERY_INFO_Req;


Line 30: Line 30:
     uint16      c;
     uint16      c;
     uint16      d;
     uint16      d;
     uint16      temp;  ''Battery temperature measured in Kelvin''
     uint16      temp;  // Battery temperature measured in Kelvin  
     uint16      f;
     uint16      f;
     uint16      g;
     uint16      g;
Line 39: Line 39:
     uint16      l;
     uint16      l;
};
};
</code>
</pre>
 
== Some BULK0 message (0x42, 0x00) ==
 
<pre>
typedef struct {
    BMEHeader header;
    u_int32_t flags;  // Set to 0xFFFFFFFF to get all data
} BME_EM_BULK_Req;
 
struct emsg_bme_bulk_reply {
  uint32    unknown1;
  uint32    unknown2;
  uint32    unknown3;
  uint16    sw_status; // Battery monitor SW status
  uint16    instaneous_battery_voltage; // Instantaneous battery voltage (mV)
  uint16      // Remaining standby time to battery low (mins)
  uint16    unknown4;
  uint16    unknown5;
  uint16    unknown6;
  uint16    // Battery monitor check voltage (mV)
  uint16    // Battery low warning interval counter
  uint16    // Double median filtered battery voltage
  uint16    // Initial battery monitor voltage (mV)
  uint16    // Time per battery bar (mins)
  uint16    // DMF voltage sampled at first battery low (mV)
  uint32    // Average phone current (uA)
  uint16    // Most recent battery charge condition (mAh)
  uint16    // Lowest TX-Off voltage (mV)
  uint16    // Lowest TX-On voltage (mV)
  uint16    // Largest TX-Off/On voltage difference (mV)
  uint8      // Battery bar level log mask
  uint8      // Previous battery bar level
  uint8      // Battery low reason
  uint8      // CS state information
  uint16    // Number of battery bars
  uint16    // Battery type
  uint16    // Temperature, in kelvin
  uint16    // Battery capacity
  uint16    // Battery impedance (mOhm)
  uint16    // Present value of v_bat_full_level
  uint16    // Present value of v_bat_low_ths_mv
  uint16    unknown7;
  uint16    unknown8;
  uint16    unknown9;
  uint16    // Load current estimated by Batmon4 (uA)
  uint16    unknown10;
};
</pre>

Revision as of 15:44, 7 February 2009

This documentation is entirely for the purpose of implementing software gathering battery information on Nokia Internet Tablets, not alteration of battery management state.

General protocol, published https://garage.maemo.org/plugins/scmsvn/viewcvs.php/dsme/trunk/adhoc/dummy_bme.c?revision=155&root=dsm&view=markup , released as LGPL 2.1

  • UNIX socket connection to /tmp/.bmesrv
  • Client: send('BMentity')
  • Server: send('\n')

After handshake:

typedef struct {
    uint16      type, subtype;
} BMEHeader;

types so far (NAME, (type, subtype)):

EM_BATTERY_INFO_REQ (0x06, 0x00)

typedef struct {
    BMEHeader header;
    u_int32_t flags;   // Set to 0xFFFFFFFF to get all data
} BME_EM_BATTERY_INFO_Req;

struct emsg_battery_info_reply {
    uint32      a;
    uint32      flags;
    uint16      c;
    uint16      d;
    uint16      temp;   // Battery temperature measured in Kelvin 
    uint16      f;
    uint16      g;
    uint16      h;
    uint16      i;
    uint16      j;
    uint16      k;
    uint16      l;
};

Some BULK0 message (0x42, 0x00)

typedef struct {
    BMEHeader header;
    u_int32_t flags;   // Set to 0xFFFFFFFF to get all data
} BME_EM_BULK_Req;

struct emsg_bme_bulk_reply {
   uint32     unknown1;
   uint32     unknown2;
   uint32     unknown3;
   uint16     sw_status; // Battery monitor SW status
   uint16     instaneous_battery_voltage; // Instantaneous battery voltage (mV)
   uint16      // Remaining standby time to battery low (mins)
   uint16     unknown4;
   uint16     unknown5;
   uint16     unknown6;
   uint16     // Battery monitor check voltage (mV)
   uint16     // Battery low warning interval counter
   uint16     // Double median filtered battery voltage
   uint16     // Initial battery monitor voltage (mV)
   uint16     // Time per battery bar (mins)
   uint16     // DMF voltage sampled at first battery low (mV)
   uint32     // Average phone current (uA)
   uint16     // Most recent battery charge condition (mAh)
   uint16     // Lowest TX-Off voltage (mV)
   uint16     // Lowest TX-On voltage (mV)
   uint16     // Largest TX-Off/On voltage difference (mV)
   uint8      // Battery bar level log mask
   uint8      // Previous battery bar level
   uint8      // Battery low reason
   uint8      // CS state information 
   uint16     // Number of battery bars
   uint16     // Battery type
   uint16     // Temperature, in kelvin
   uint16     // Battery capacity 
   uint16     // Battery impedance (mOhm)
   uint16     // Present value of v_bat_full_level
   uint16     // Present value of v_bat_low_ths_mv
   uint16     unknown7;
   uint16     unknown8;
   uint16     unknown9;
   uint16     // Load current estimated by Batmon4 (uA)
   uint16     unknown10;
};