title: Writing BLE to Cycling Control Point - Adding Resistance
body: <p>I have bee working with BLE for a while now, but primarily for reading and notifying characteristics.</p>
  
  <p>The devices specifically are Virtual cycle trainers that support <strong>GATTS Cycling Power Service - 0x1818 <a href="https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.cycling_power.xml" rel="nofollow noreferrer">link</a></strong></p>
  
  <p>I know that it's possible to increase resistance on this trainer, but I have read the documentation on <strong>Cycling Power Control Point -  0x2A66 [link][2]</strong> which is the only one with Mandatory write functions, but non of the documentation seem to be make sense.</p>
  
  <p><strong>Trainer: <em>Cycleops Magnus</em></strong></p>
  
  <p><strong>Reading and writing characteristic</strong> </p>
  
  <pre><code>// Reads all characteristics
  var characteristics = service.characteristics;
  for(BluetoothCharacteristic c in characteristics) {
      List&lt;int&gt; value = await device.readCharacteristic(c);
      print(value);
  }
  
  // Writes to a characteristic
  await device.writeCharacteristic(c, [0x12, 0x34])
  </code></pre>
  
  <p><strong>Reading and writing descriptors</strong></p>
  
  <pre><code>// Reads all descriptors
  var descriptors = characteristic.descriptors;
  for(BluetoothDescriptor d in descriptors) {
      List&lt;int&gt; value = await device.readDescriptor(d);
      print(value);
  }
  
  // Writes to a descriptor
  await device.writeDescriptor(d, [0x12, 0x34])
  </code></pre>
  
  <p>The closest I can see is setting the crank length, or chain weight but at this stage I am only guessing and am looking for some guidance.</p>
  
  <p><strong>The questions is this..</strong></p>
  
  <blockquote>
    <p>What characteristic or descriptor should I use to adjust Virtual Power
    trainer resistance and what is the best way to do this?</p>
  </blockquote>
  
  <p><strong>Any coding Language is fine, I can transpose it.</strong></p>
  
  <p>Screenshot of services available for device</p>
  
  <p>[2]: <a href="https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.cycling_power_control_point.xml" rel="nofollow noreferrer">https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.cycling_power_control_point.xml</a><img src="https://i.stack.imgur.com/UOsLL.jpg" alt="enter image description here"></p>