         struct Enabled {
             static let uuid = "F000AA12-0451-4000-B000-000000000000"
             static let name = "Accelerometer Enabled"
-            enum Value: UInt8, DeserializedEnum {
-                case No     = 0
-                case Yes    = 1
-                static func fromRaw(value:UInt8) -> Value? {
-                    switch value {
-                    case 0:
-                        return Value.No
-                    case 1:
-                        return Value.Yes
-                    default:
-                        return nil
-                    }
-                }
-                static func fromString(value:String) -> Value? {
-                    switch value {
-                    case "No":
-                        return Value.No
-                    case "Yes":
-                        return Value.Yes
-                    default:
-                        return nil
-                    }
-                }
-                static func stringValues() -> [String] {
-                    return ["No", "Yes"]
-                }
-                var stringValue : String {
-                    switch self {
-                    case .No:
-                        return "No"
-                    case .Yes:
-                        return "Yes"
-                    }
-                }
-                func toRaw() -> UInt8 {
-                    switch self {
-                    case .No:
-                        return 0
-                    case .Yes:
-                        return 1
-                    }
-                }
-            }
         }
         // Accelerometer Update Period
         struct UpdatePeriod {
             static let uuid = "F000AA13-0451-4000-B000-000000000000"
             static let name = "Accelerometer Update Period"
-            struct Value : DeserializedStruct {
-                var periodRaw : UInt8
-                var period : Int
-                static func fromRawValues(values:[UInt8]) -> Value? {
-                    var period = 10*Int(values[0])
-                    if period < 10 {
-                        period = 10
-                    }
-                    return Value(periodRaw:values[0], period:period)
-                }
-                static func fromStrings(values:Dictionary<String, String>) -> Value? {
-                    if let period = values["period"]?.toInt() {
-                        let rawPeriod = self.periodRawFromPeriod(period)
-                        return Value(periodRaw:rawPeriod, period:10*period)
-                    } else {
-                        return nil
-                    }
-                }
-                static func periodRawFromPeriod(period:Int) -> UInt8 {
-                    let scaledPeriod = period/10
-                    if scaledPeriod > 255 {
-                        return 255
-                    } else if scaledPeriod < 10 {
-                        return 10
-                    } else {
-                        return UInt8(scaledPeriod)
-                    }
-                }
-                var stringValues : Dictionary<String,String> {
-                    return ["periodRaw":"\(periodRaw)", "period":"\(period)"]
-                }
-                func toRawValues() -> [UInt8] {
-                    return [periodRaw]
-                }
-            }
         }
     }
     
     //***************************************************************************************************
-    // Magnetometer Service
+    // Magnetometer Service: units are uT
     //***************************************************************************************************
     struct MagnetometerService {
         static let uuid = "F000AA30-0451-4000-B000-000000000000"

        }
    }
    

}

class TISensorTagServiceProfiles {

        // Magnetometer Service
        //***************************************************************************************************
        profileManage.addService(ServiceProfile(uuid:TISensorTag.MagnetometerService.uuid, name:TISensorTag.MagnetometerService.name){(serviceProfile:ServiceProfile) in
            // Magentometer Data
            // Magnetometer Enabled
            serviceProfile.addCharacteristic(EnumCharacteristicProfile<TISensorTag.Enabled>(uuid:TISensorTag.MagnetometerService.Enabled.uuid, name: TISensorTag.MagnetometerService.name){(characteristicProfile:EnumCharacteristicProfile<TISensorTag.Enabled>) in
                    characteristicProfile.initialValue = NSData.serialize(TISensorTag.Enabled.No)
                    characteristicProfile.properties = CBCharacteristicProperties.Read | CBCharacteristicProperties.Write
                    characteristicProfile.afterDiscovered(){(characteristic:Characteristic) in
                        characteristic.write(TISensorTag.Enabled.Yes, afterWriteSuccessCallback:{})
                    }
                })
            // Magnetometer Update Period
            serviceProfile.addCharacteristic(StructCharacteristicProfile<TISensorTag.UInt8Period>(uuid:TISensorTag.MagnetometerService.UpdatePeriod.uuid, name:TISensorTag.MagnetometerService.UpdatePeriod.name)
                {(characteristicProfile:StructCharacteristicProfile<TISensorTag.UInt8Period>) in
                    characteristicProfile.initialValue = NSData.serialize(0x64 as UInt8)
                    characteristicProfile.properties = CBCharacteristicProperties.Read | CBCharacteristicProperties.Write | CBCharacteristicProperties.Notify
                })
        })

        //***************************************************************************************************
