{
- "supported": ["VehicleSpeed", "EngineSpeed", "VehiclePowerMode", "TripMeter",
+ "supported": ["VehicleSpeed", "WheelSpeed", "EngineSpeed", "VehiclePowerModeType", "TripMeter",
"Acceleration", "Transmission", "CruiseControlStatus", "WheelBrake",
"LightStatus", "InteriorLightStatus", "Horn", "Fuel", "EngineOil",
"Location", "ExteriorBrightness", "Temperature", "RainSensor",
- "WindshieldWiper", "HVAC", "WindowStatus", "Sunroof", "ConvertibleRoof",
- "VehicleId", "Size", "FuelInfo", "VehicleType", "Doors",
- "TransmissionGearType", "WheelInformation", "Odometer", "Fluid", "Battery",
+ "WindshieldWiper", "ClimateControl", "WindowStatus", "Sunroof", "ConvertibleRoof",
+ "Identification", "SizeConfiguration", "FuelConfiguration", "VehicleType", "Doors",
+ "TransmissionConfiguration", "WheelInformation", "Odometer", "Fluid", "BatteryStatus",
"TirePressure", "TireTemperature", "SecurityAlert", "ParkingBrake",
"ParkingLight", "HazardLight", "AntilockBrakingSystem", "TractionControlSystem",
"VehicleTopSpeedLimit", "AirbagStatus", "DoorStatus", "SeatBeltStatus",
"OccupantStatus", "ObstacleDistance", "NightMode", "DrivingMode",
- "TurnSignal", "ButtonEvent"],
+ "TurnSignal", "ButtonEvent", "SteeringWheel", "ThrottlePosition", "EngineCoolant"],
"newestHistory": null,
"currentConfiguration": 0,
"configurationData": [
],
"settingData": [
0, 0, true, 0, true, false, false, false, false, false, false, false, false, false, false, false, false,
- 0, 0x04, 0, 0, false, false, false, false, false, false, 0, 0, 0, true, true, true, true, true, true, 120,
- 0, true, 2, 0, true, true, false, 0, 10, false, 0, 0, 0, 0, 10, 80, 50, 50, 70, 70, 10, 10, 10, 10 ],
+ 0, 0x04, 0, 0, false, false, false, false, false, false, 0, 0, "closed", true, "inactive", true, true, true, true, 120,
+ 0, true, false, 0, true, true, false, 0, 10, false, false, 0, 0, 0, 10, 80, 50, 50, 70, 70, 10, 10, 10, 10 ],
"autoRunningData": [
- [0, 0, 0, [0], 0, 0, 0, 100, 20, 59, 10, 15, 100, 5, 0, -23.5, -54.4, 100.1, 0, 100, 0, 9, 0, 1500, 10, 10],
- [10, 100, 3, [100], 10, 10, 10, 99, 20, 59, 10, 15, 99, 10, 20, -23.0, -53.2, 100.4, 0, 100, 5, 4, 0, 1600, 10, 10],
- [20, 200, 3, [110], 20, 20, 20, 98, 20, 59, 10, 15, 98, 20, 30, -22.5, -54.0, 100.9, 0, 100, 15, 5, 0, 1700, 10, 10],
- [30, 300, 3, [120], 20, 20, 20, 97, 20, 59, 10, 15, 97, 30, 40, -22.0, -55.4, 100.5, 0, 100, 20, 6, 0, 1800, 10, 10],
- [40, 400, 3, [130], 20, 20, 20, 96, 20, 59, 10, 15, 96, 35, 54, -21.5, -54.4, 99.4, 0, 100, 22, 2, 0, 1900, 10, 10],
- [50, 500, 3, [140], 20, 20, 20, 95, 20, 59, 10, 15, 95, 32, 50, -21.0, -54.9, 100.5, 0, 100, 21, 5, 0, 2000, 10, 10],
- [60, 600, 3, [140, 100], 20, 20, 20, 94, 20, 59, 10, 15, 94, 30, 54, -20.5, -54.4, 98.9, 0, 100, 20, 7, 0, 2100, 10, 10],
- [70, 700, 3, [140, 110], 20, 20, 20, 93, 20, 59, 10, 15, 93, 31, 51, -20.0, -54.4, 100.5, 0, 100, 21, 9, 0, 2200, 10, 10],
- [80, 800, 3, [140, 120], 20, 20, 20, 92, 20, 59, 10, 15, 92, 30, 54, -19.5, -56.4, 99.5, 0, 100, 21, 8, 0, 2300, 10, 10],
- [90, 900, 3, [140, 130], 20, 20, 20, 91, 20, 59, 10, 15, 91, 32, 49, -19.0, -54.4, 100.5, 0, 100, 21, 6, 0, 2400, 10, 10],
- [100, 1000, 3, [140, 140], 20, 20, 20, 90, 20, 59, 10, 15, 90, 30, 54, -18.5, -52.4, 100.5, 0, 100, 22, 9, 0, 2500, 10, 10],
- [110, 1100, 3, [140, 150], 20, 20, 20, 89, 20, 59, 10, 15, 89, 30, 54, -18.0, -54.4, 100.5, 0, 100, 21, 8, 0, 2600, 10, 10],
- [120, 1200, 3, [140, 160], 20, 20, 20, 88, 20, 59, 10, 15, 88, 29, 48, -17.8, -51.4, 97.2, 0, 100, 20, 6, 0, 2700, 10, 10],
- [130, 1300, 3, [140, 160, 100], 20, 20, 20, 87, 20, 59, 10, 15, 87, 30, 54, -17.4, -54.1, 100.5, 0, 100, 21, 5, 0, 2800, 10, 10],
- [140, 1400, 3, [140, 160, 110], 20, 20, 20, 86, 20, 59, 10, 15, 86, 25, 46, -16.9, -54.4, 100.2, 0, 100, 19, 4, 0, 2900, 10, 10],
- [150, 1500, 3, [140, 160, 120], 20, 20, 20, 85, 20, 59, 10, 15, 85, 30, 54, -16.4, -54.3, 100.5, 0, 100, 21, 9, 0, 3000, 10, 10],
- [160, 1600, 3, [140, 160, 130], 20, 20, 20, 84, 20, 59, 10, 15, 84, 30, 54, -16.0, -54.4, 100.5, 0, 100, 23, 3, 0, 3100, 10, 10],
- [170, 1700, 3, [140, 160, 140], 20, 20, 20, 83, 20, 59, 10, 15, 83, 28, 51, -15.0, -54.4, 100.0, 0, 100, 21, 5, 0, 3200, 10, 10],
- [180, 1800, 3, [140, 160, 150], 20, 20, 20, 82, 20, 59, 10, 15, 82, 30, 54, -14.3, -54.9, 100.5, 0, 100, 21, 6, 0, 3300, 10, 10],
- [190, 1900, 3, [140, 160, 160], 20, 20, 20, 81, 20, 59, 10, 15, 81, 27, 54, -14.0, -54.4, 100.5, 0, 100, 20, 5, 0, 3400, 10, 10],
- [200, 2000, 3, [140, 160, 170], 20, 20, 20, 80, 20, 59, 10, 15, 80, 30, 52, -13.2, -54.4, 101.5, 0, 100, 21, 5, 0, 3500, 10, 10],
- [210, 2100, 3, [140, 160, 180], 20, 20, 20, 79, 20, 59, 10, 15, 79, 30, 53, -12.5, -54.4, 100.5, 0, 100, 22, 6, 0, 3600, 10, 10],
- [220, 2200, 3, [140, 160, 190], 20, 20, 20, 78, 20, 59, 10, 15, 78, 32, 54, -11.0, -54.7, 105.5, 0, 100, 21, 4, 0, 3700, 10, 10],
- [230, 2300, 3, [140, 160, 200], 20, 20, 20, 77, 20, 59, 10, 15, 77, 30, 54, -10.5, -51.9, 100.5, 0, 100, 22, 0, 0, 3800, 10, 10],
- [240, 2400, 3, [140, 160, 200, 100], 20, 20, 20, 76, 20, 59, 10, 15, 76, 33, 55, -6.9, -54.4, 100.3, 0, 100, 21, 8, 0, 3900, 10, 10],
- [250, 2500, 3, [140, 160, 200, 110], 20, 20, 20, 75, 20, 59, 10, 15, 75, 30, 54, 0, -54.4, 110.5, 0, 100, 21, 1, 0, 4000, 10, 10],
- [260, 2600, 3, [140, 160, 200, 110, 100], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4100, 10, 10],
- [270, 2700, 3, [140, 160, 200, 110, 110], 20, 20, 20, 73, 20, 59, 10, 15, 73, 30, 50, 11.2, -54.4, 100.5, 0, 100, 21, 6, 0, 4200, 10, 10],
- [280, 2800, 3, [140, 160, 200, 110, 120], 20, 20, 20, 72, 20, 59, 10, 15, 72, 28, 54, 12.5, -54.4, 102.4, 0, 100, 18, 5, 0, 4300, 10, 10],
- [270, 2700, 3, [140, 160, 200, 110, 130], 20, 20, 20, 73, 20, 59, 10, 15, 73, 30, 50, 11.2, -54.4, 100.5, 0, 100, 21, 6, 0, 4400, 10, 10],
- [260, 2600, 3, [140, 160, 200, 110, 140], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4500, 10, 10],
- [240, 2400, 3, [140, 160, 200, 110, 150], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4600, 10, 10],
- [220, 2200, 3, [140, 160, 200, 110, 160], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4700, 10, 10],
- [200, 2000, 3, [140, 160, 200, 110, 170], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4800, 10, 10],
- [180, 1800, 3, [140, 160, 200, 110, 180], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4900, 10, 10],
- [160, 1600, 3, [140, 160, 200, 110, 190], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5000, 10, 10],
- [140, 1400, 3, [140, 160, 200, 110, 200], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5100, 10, 10],
- [120, 1200, 3, [140, 160, 200, 110, 210], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5200, 10, 10],
- [100, 1000, 3, [140, 160, 200, 110, 220], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5300, 10, 10],
- [80, 800, 3, [140, 160, 200, 110, 230], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5400, 10, 10],
- [60, 600, 3, [140, 160, 200, 110, 240], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5500, 10, 10],
- [40, 400, 3, [140, 160, 200, 110, 250], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5600, 10, 10],
- [20, 200, 3, [140, 160, 200, 110, 260], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5700, 10, 10],
- [10, 100, 3, [140, 160, 200, 110, 270], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5800, 10, 10]
+ [0, 0, 0, 0, [0], 0, 0, 0, 100, 20, 59, 10, 15, 100, 5, 0, -23.5, -54.4, 100.1, 0, 100, 0, 9, 0, 1500, 10, 10, -90, 0, 10, 40],
+ [10, 10, 100, 3, [100], 10, 10, 10, 99, 20, 59, 10, 15, 99, 10, 20, -23.0, -53.2, 100.4, 0, 100, 5, 4, 0, 1600, 10, 10, -80, 2, 10, 41],
+ [20, 20, 200, 3, [110], 20, 20, 20, 98, 20, 59, 10, 15, 98, 20, 30, -22.5, -54.0, 100.9, 0, 100, 15, 5, 0, 1700, 10, 10, -70, 4, 10, 42],
+ [30, 30, 300, 3, [120], 20, 20, 20, 97, 20, 59, 10, 15, 97, 30, 40, -22.0, -55.4, 100.5, 0, 100, 20, 6, 0, 1800, 10, 10, -60, 6, 10, 43],
+ [40, 40, 400, 3, [130], 20, 20, 20, 96, 20, 59, 10, 15, 96, 35, 54, -21.5, -54.4, 99.4, 0, 100, 22, 2, 0, 1900, 10, 10, -50, 8, 10, 44],
+ [50, 50, 500, 3, [140], 20, 20, 20, 95, 20, 59, 10, 15, 95, 32, 50, -21.0, -54.9, 100.5, 0, 100, 21, 5, 0, 2000, 10, 10, -40, 10, 10, 45],
+ [60, 60, 600, 3, [140, 100], 20, 20, 20, 94, 20, 59, 10, 15, 94, 30, 54, -20.5, -54.4, 98.9, 0, 100, 20, 7, 0, 2100, 10, 10, -30, 12, 10, 50],
+ [70, 70, 700, 3, [140, 110], 20, 20, 20, 93, 20, 59, 10, 15, 93, 31, 51, -20.0, -54.4, 100.5, 0, 100, 21, 9, 0, 2200, 10, 10, -20, 14, 10, 51],
+ [80, 80, 800, 3, [140, 120], 20, 20, 20, 92, 20, 59, 10, 15, 92, 30, 54, -19.5, -56.4, 99.5, 0, 100, 21, 8, 0, 2300, 10, 10, -10, 16, 10, 52],
+ [90, 90, 900, 3, [140, 130], 20, 20, 20, 91, 20, 59, 10, 15, 91, 32, 49, -19.0, -54.4, 100.5, 0, 100, 21, 6, 0, 2400, 10, 10, 0, 18, 10, 53],
+ [100, 100, 1000, 3, [140, 140], 20, 20, 20, 90, 20, 59, 10, 15, 90, 30, 54, -18.5, -52.4, 100.5, 0, 100, 22, 9, 0, 2500, 10, 10, 10, 20, 10, 54],
+ [110, 110, 1100, 3, [140, 150], 20, 20, 20, 89, 20, 59, 10, 15, 89, 30, 54, -18.0, -54.4, 100.5, 0, 100, 21, 8, 0, 2600, 10, 10, 20, 22, 10, 55],
+ [120, 120, 1200, 3, [140, 160], 20, 20, 20, 88, 20, 59, 10, 15, 88, 29, 48, -17.8, -51.4, 97.2, 0, 100, 20, 6, 0, 2700, 10, 10, 30, 24, 10, 60],
+ [130, 130, 1300, 3, [140, 160, 100], 20, 20, 20, 87, 20, 59, 10, 15, 87, 30, 54, -17.4, -54.1, 100.5, 0, 100, 21, 5, 0, 2800, 10, 10, 40, 26, 10, 61],
+ [140, 140, 1400, 3, [140, 160, 110], 20, 20, 20, 86, 20, 59, 10, 15, 86, 25, 46, -16.9, -54.4, 100.2, 0, 100, 19, 4, 0, 2900, 10, 10, 50, 28, 10, 62],
+ [150, 150, 1500, 3, [140, 160, 120], 20, 20, 20, 85, 20, 59, 10, 15, 85, 30, 54, -16.4, -54.3, 100.5, 0, 100, 21, 9, 0, 3000, 10, 10, 60, 30, 10, 63],
+ [160, 160, 1600, 3, [140, 160, 130], 20, 20, 20, 84, 20, 59, 10, 15, 84, 30, 54, -16.0, -54.4, 100.5, 0, 100, 23, 3, 0, 3100, 10, 10, 70, 32, 10, 64],
+ [170, 170, 1700, 3, [140, 160, 140], 20, 20, 20, 83, 20, 59, 10, 15, 83, 28, 51, -15.0, -54.4, 100.0, 0, 100, 21, 5, 0, 3200, 10, 10, 80, 34, 10, 65],
+ [180, 180, 1800, 3, [140, 160, 150], 20, 20, 20, 82, 20, 59, 10, 15, 82, 30, 54, -14.3, -54.9, 100.5, 0, 100, 21, 6, 0, 3300, 10, 10, 90, 36, 10, 80],
+ [190, 190, 1900, 3, [140, 160, 160], 20, 20, 20, 81, 20, 59, 10, 15, 81, 27, 54, -14.0, -54.4, 100.5, 0, 100, 20, 5, 0, 3400, 10, 10, 80, 38, 10, 81],
+ [200, 200, 2000, 3, [140, 160, 170], 20, 20, 20, 80, 20, 59, 10, 15, 80, 30, 52, -13.2, -54.4, 101.5, 0, 100, 21, 5, 0, 3500, 10, 10, 70, 40, 10, 82],
+ [210, 210, 2100, 3, [140, 160, 180], 20, 20, 20, 79, 20, 59, 10, 15, 79, 30, 53, -12.5, -54.4, 100.5, 0, 100, 22, 6, 0, 3600, 10, 10, 60, 42, 10, 83],
+ [220, 220, 2200, 3, [140, 160, 190], 20, 20, 20, 78, 20, 59, 10, 15, 78, 32, 54, -11.0, -54.7, 105.5, 0, 100, 21, 4, 0, 3700, 10, 10, 50, 44, 10, 84],
+ [230, 230, 2300, 3, [140, 160, 200], 20, 20, 20, 77, 20, 59, 10, 15, 77, 30, 54, -10.5, -51.9, 100.5, 0, 100, 22, 0, 0, 3800, 10, 10, 40, 46, 10, 85],
+ [240, 240, 2400, 3, [140, 160, 200, 100], 20, 20, 20, 76, 20, 59, 10, 15, 76, 33, 55, -6.9, -54.4, 100.3, 0, 100, 21, 8, 0, 3900, 10, 10, 30, 48, 10, 100],
+ [250, 250, 2500, 3, [140, 160, 200, 110], 20, 20, 20, 75, 20, 59, 10, 15, 75, 30, 54, 0, -54.4, 110.5, 0, 100, 21, 1, 0, 4000, 10, 10, 20, 50, 10, 101],
+ [260, 260, 2600, 3, [140, 160, 200, 110, 100], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4100, 10, 10, 10, 52, 10, 102],
+ [270, 270, 2700, 3, [140, 160, 200, 110, 110], 20, 20, 20, 73, 20, 59, 10, 15, 73, 30, 50, 11.2, -54.4, 100.5, 0, 100, 21, 6, 0, 4200, 10, 10, 0, 54, 10, 103],
+ [280, 280, 2800, 3, [140, 160, 200, 110, 120], 20, 20, 20, 72, 20, 59, 10, 15, 72, 28, 54, 12.5, -54.4, 102.4, 0, 100, 18, 5, 0, 4300, 10, 10, 0, 56, 10, 104],
+ [270, 270, 2700, 3, [140, 160, 200, 110, 130], 20, 20, 20, 73, 20, 59, 10, 15, 73, 30, 50, 11.2, -54.4, 100.5, 0, 100, 21, 6, 0, 4400, 10, 10, -10, 58, 10, 105],
+ [260, 260, 2600, 3, [140, 160, 200, 110, 140], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4500, 10, 10, -20, 60, 10, 110],
+ [240, 240, 2400, 3, [140, 160, 200, 110, 150], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4600, 10, 10, -40, 62, 10, 111],
+ [220, 220, 2200, 3, [140, 160, 200, 110, 160], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4700, 10, 10, -60, 64, 10, 112],
+ [200, 200, 2000, 3, [140, 160, 200, 110, 170], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4800, 10, 10, -80, 66, 10, 113],
+ [180, 180, 1800, 3, [140, 160, 200, 110, 180], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 4900, 10, 10, -90, 68, 10, 114],
+ [160, 160, 1600, 3, [140, 160, 200, 110, 190], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5000, 10, 10, -80, 70, 10, 115],
+ [140, 140, 1400, 3, [140, 160, 200, 110, 200], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5100, 10, 10, -70, 72, 10, 120],
+ [120, 120, 1200, 3, [140, 160, 200, 110, 210], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5200, 10, 10, -40, 74, 10, 121],
+ [100, 100, 1000, 3, [140, 160, 200, 110, 220], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5300, 10, 10, -20, 76, 10, 122],
+ [80, 80, 800, 3, [140, 160, 200, 110, 230], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5400, 10, 10, -10, 78, 10, 123],
+ [60, 60, 600, 3, [140, 160, 200, 110, 240], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5500, 10, 10, 0, 80, 10, 124],
+ [40, 40, 400, 3, [140, 160, 200, 110, 250], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5600, 10, 10, 0, 82, 10, 125],
+ [20, 20, 200, 3, [140, 160, 200, 110, 260], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5700, 10, 10, 0, 84, 10, 130],
+ [10, 10, 100, 3, [140, 160, 200, 110, 270], 20, 20, 20, 74, 20, 59, 10, 15, 74, 29, 54, 1.9, -54.4, 100.5, 0, 100, 20, 7, 0, 5800, 10, 10, 10, 86, 10, 131]
]
}
/*!
- Ripple Mobile Environment Emulator v0.9.8 :: Built On Fri Aug 08 2014 14:09:19 GMT+0800 (CST)
+ Ripple Mobile Environment Emulator v0.9.8 :: Built On Wed Sep 24 2014 17:34:15 GMT+0800 (CST)
Apache License
Version 2.0, January 2004
};
});
+define('ripple/devices/Wearable-HD', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless requWEBAPIS-HD.jsired by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = {
+ "id": "Wearable-HD",
+ "name": "Wearable HD (320X320)",
+ "osName": "Generic",
+ "osVersion": "Generic",
+ "manufacturer": "Tizen",
+ "model": "Generic",
+ "uuid": "42",
+ "firmware": "Generic",
+
+ "screen": {
+ "width": 320,
+ "height": 320
+ },
+ "viewPort": {
+ "portrait": {
+ "width": 320,
+ "height": 320,
+ "paddingTop": 0,
+ "paddingLeft": 0
+ },
+ "landscape": {
+ "width": 320,
+ "height": 320,
+ "paddingTop": 0,
+ "paddingLeft": 0
+ }
+ },
+
+ "ppi": 316,
+ "browser": ["Generic"],
+ "platforms": ["wearable"],
+ "userAgent": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2"
+};
+
+});
define('ripple/devices/custom', function (require, exports, module) {
/*
* Copyright 2012 Intel Corporation
"G1",
*/ "FULL-HD",
"IVI-HD",
+ "Wearable-HD",
"tizen-WVGA",
/*
"HPPre3",
//can support all properties.
_vehicleMapStack.vehicleProperties = [
- "VehicleSpeed", "EngineSpeed", "VehiclePowerMode", "TripMeter",
+ "VehicleSpeed", "WheelSpeed", "EngineSpeed", "VehiclePowerModeType", "TripMeter",
"Acceleration", "Transmission", "CruiseControlStatus", "WheelBrake",
"LightStatus", "InteriorLightStatus", "Horn", "Fuel", "EngineOil",
"Location", "ExteriorBrightness", "Temperature", "RainSensor",
- "WindshieldWiper", "HVAC", "WindowStatus", "Sunroof", "ConvertibleRoof",
- "VehicleId", "Size", "FuelInfo", "VehicleType", "Doors",
- "TransmissionGearType", "WheelInformation", "Odometer", "Fluid", "Battery",
+ "WindshieldWiper", "ClimateControl", "WindowStatus", "Sunroof", "ConvertibleRoof",
+ "Identification", "SizeConfiguration", "FuelConfiguration", "VehicleType", "Doors",
+ "TransmissionConfiguration", "WheelInformation", "Odometer", "Fluid", "BatteryStatus",
"TirePressure", "TireTemperature", "SecurityAlert", "ParkingBrake",
"ParkingLight", "HazardLight", "AntilockBrakingSystem", "TractionControlSystem",
"VehicleTopSpeedLimit", "AirbagStatus", "DoorStatus", "SeatBeltStatus",
"OccupantStatus", "ObstacleDistance", "NightMode", "DrivingMode",
- "TurnSignal", "ButtonEvent"
+ "TurnSignal", "ButtonEvent", "SteeringWheel", "ThrottlePosition", "EngineCoolant"
];
//Vehicle Configuration
_vehicleMapStack.vehicleConfigurationMap = [
- "VehicleId-WMI", "VehicleId-VIN",
- "Size-width", "Size-height", "Size-length",
- "FuelInfo-type", "FuelInfo-refuelPosition",
+ "Identification-WMI", "Identification-VIN",
+ "SizeConfiguration-width", "SizeConfiguration-height", "SizeConfiguration-length",
+ "FuelConfiguration-fuelType", "FuelConfiguration-refuelPosition",
"VehicleType-type",
"Doors-doorsPerRow",
- "TransmissionGearType-transmissionGearType",
+ "TransmissionConfiguration-transmissionGearType",
"WheelInformation-frontWheelRadius", "WheelInformation-rearWheelRadius", "WheelInformation-wheelTrack", "WheelInformation-ABS"
];
//all ranged attributes' min. max and step.
_vehicleMapStack.vehiclePropertyRangeMap = {
- "VehicleSpeed-vehicleSpeed": [0, 400, 1],
- "EngineSpeed-engineSpeed": [0, 10000, 20],
+ "VehicleSpeed-speed": [0, 400, 1],
+ "WheelSpeed-speed": [0, 400, 1],
+ "EngineSpeed-speed": [0, 10000, 20],
"Acceleration-x": [0, 200, 1],
"Acceleration-y": [0, 200, 1],
"Acceleration-z": [0, 200, 1],
"Fuel-level": [0, 100, 1],
"Fuel-range": [0, 1000, 1],
"Fuel-instantConsumption": [0, 100, 1],
- "Fuel-instantEconomy": [0, 100, 1],
- "Fuel-averageEconomy": [0, 100, 1],
+ "Fuel-fuelConsumedSinceRestart": [0, 100, 1],
+ "Fuel-vehicleTimeSinceRestart": [0, 100, 1],
"EngineOil-remaining": [0, 100, 1],
"EngineOil-temperature": [0, 100, 1],
"EngineOil-pressure": [0, 1000, 1],
"Location-altitude": [0, 100, 1],
"Location-direction": [0, 360, 1],
"ExteriorBrightness-exteriorBrightness": [0, 100, 1],
- "Temperature-interior": [-5, 35, 1],
- "Temperature-exterior": [-40, 60, 1],
- "Odometer-odometer": [0, 10000, 10],
+ "Temperature-interiorTemperature": [-5, 35, 1],
+ "Temperature-exteriorTemperature": [-40, 60, 1],
+ "Odometer-distanceTotal": [0, 10000, 10],
"CruiseControlStatus-speed": [1, 100, 1],
- "HVAC-targetTemperature": [0, 35, 7],
+ "ClimateControl-targetTemperature": [0, 35, 7],
"Sunroof-openness": [0, 100, 1],
"Sunroof-tilt": [0, 100, 1],
- "ConvertibleRoof-openness": [0, 100, 1],
"WindowStatus-openness": [0, 100, 1],
"VehicleTopSpeedLimit-vehicleTopSpeedLimit": [0, 400, 1],
"ObstacleDistance-obstacleDistance": [0, 120, 1],
"Fluid-transmission": [0, 100, 1],
"Fluid-brake": [0, 100, 1],
"Fluid-washer": [0, 100, 1],
- "Battery-voltage": [0, 12, 1],
- "Battery-current": [0, 200, 1],
+ "BatteryStatus-voltage": [0, 12, 1],
+ "BatteryStatus-current": [0, 200, 1],
"TirePressure-leftFront": [0, 500, 1],
"TirePressure-rightFront": [0, 500, 1],
"TirePressure-leftRear": [0, 500, 1],
"TireTemperature-leftRear": [0, 60, 1],
"TireTemperature-rightRear": [0, 60, 1],
"TurnSignal-turnSignal": [0, 100, 1],
- "ButtonEvent-buttonEvent": [0, 100, 1]
+ "ButtonEvent-buttonEvent": [0, 100, 1],
+ "SteeringWheel-angle": [-90, 90, 1],
+ "ThrottlePosition-value": [0, 100, 1],
+ "EngineCoolant-level": [0, 100, 1],
+ "EngineCoolant-temperature": [0, 100, 1],
};
//simulate car running attributes' controller-types.
_vehicleMapStack.vehicleAutoRunningMap = {
- "VehicleSpeed-vehicleSpeed": {
+ "VehicleSpeed-speed": {
+ "type": "range"
+ },
+ "WheelSpeed-speed": {
"type": "range"
},
- "EngineSpeed-engineSpeed": {
+ "EngineSpeed-speed": {
"type": "range"
},
- "VehiclePowerMode-vehiclePowerMode": {
+ "VehiclePowerModeType-value": {
"type": "select",
- "options": [{"OFF": 0},{"ACCESSORY1": 1},{"ACCESSORY2": 2},{"RUN": 3}]
+ "options": [{"OFF": "off"},{"ACCESSORY1": "accessory1"},
+ {"ACCESSORY2": "accessory2"},{"RUNNING": "running"}]
},
"TripMeter-tripMeters": {
"type": "text"
"Fuel-instantConsumption": {
"type": "range"
},
- "Fuel-instantEconomy": {
+ "Fuel-vehicleTimeSinceRestart": {
"type": "range"
},
- "Fuel-averageEconomy": {
+ "Fuel-fuelConsumedSinceRestart": {
"type": "range"
},
"EngineOil-remaining": {
"ExteriorBrightness-exteriorBrightness": {
"type": "range"
},
- "Temperature-interior": {
+ "Temperature-interiorTemperature": {
"type": "range"
},
- "Temperature-exterior": {
+ "Temperature-exteriorTemperature": {
"type": "range"
},
- "RainSensor-rainSensor": {
+ "RainSensor-rain": {
"type": "select",
"options": [{"No Rain": 0},{"Rain 1": 1},{"Rain 2": 2},{"Rain 3": 3},{"Rain 4": 4},{"Rain 5": 5},
{"Rain 6": 6},{"Rain 7": 7},{"Rain 8": 8},{"Rain 9": 9},{"Heaviest": 10}]
},
- "Odometer-odometer": {
+ "Odometer-distanceTotal": {
"type": "range"
},
"TurnSignal-turnSignal": {
},
"ButtonEvent-buttonEvent": {
"type": "range"
+ },
+ "SteeringWheel-angle": {
+ "type": "range"
+ },
+ "ThrottlePosition-value": {
+ "type": "range"
+ },
+ "EngineCoolant-level": {
+ "type": "range"
+ },
+ "EngineCoolant-temperature": {
+ "type": "range"
}
};
//Vehicle Setting attributes' controller-types.
_vehicleMapStack.vehicleSettingMap = {
- "Transmission-gearPosition": {
+ "Transmission-gear": {
"type": "select",
"options": [{"NEUTRAL": 0},{"FIRST": 1},{"SECOND": 2},{"THIRD": 3}, {"FORTH": 4},{"FIFTH": 5},
{"SIXTH": 6},{"SEVENTH": 7}, {"EIGHTH": 8},{"NINTH": 9},{"TENTH": 10},{"CVT": 64},
"type": "select",
"options": [{"NORMAL": 0},{"SPORT": 1},{"ECONOMY": 2}, {"OEMCUSTOM1": 3},{"OEMCUSTOM2": 4}]
},
- "CruiseControlStatus-activated": {
+ "CruiseControlStatus-status": {
"type": "radio",
- "options": [{"Active": true}, {"Inactive": false}]
+ "options": [{"On": true}, {"Off": false}]
},
"CruiseControlStatus-speed": {
"type": "range"
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "Horn-on": {
+ "Horn-status": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
"type": "select",
"options": [{"OFF": 0},{"SLOWEST": 1},{"FASTEST": 5},{"AUTO": 10}]
},
- "HVAC-airflowDirection": {
+ "ClimateControl-airflowDirection": {
"type": "select",
"options": [{"FRONTPANEL": 0},{"FLOORDUCT": 1},{"FRONT": 0x02}, {"DEFROSTER": 0x04}]
},
- "HVAC-fanSpeed": {
+ "ClimateControl-fanSpeedLevel": {
"type": "select",
"options": [{"0": 0},{"1": 1},{"2": 2},{"3": 3},{"4": 4},{"5": 5}, {"6": 6},{"7": 7}]
},
- "HVAC-targetTemperature": {
+ "ClimateControl-targetTemperature": {
"type": "range"
},
- "HVAC-airConditioning": {
+ "ClimateControl-airConditioning": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "HVAC-airRecirculation": {
+ "ClimateControl-airRecirculation": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "HVAC-heater": {
+ "ClimateControl-heater": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "HVAC-steeringWheelHeater": {
+ "ClimateControl-steeringWheelHeater": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "HVAC-seatHeater": {
+ "ClimateControl-seatHeater": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "HVAC-seatCooler": {
+ "ClimateControl-seatCooler": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
"Sunroof-tilt": {
"type": "range"
},
- "ConvertibleRoof-openness": {
- "type": "range"
+ "ConvertibleRoof-status": {
+ "type": "select",
+ "options": [{"CLOSED": "closed"},{"CLOSING": "closing"},
+ {"OPENING": "opening"},{"OPENED": "opened"}]
},
"SecurityAlert-securityAlert": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "ParkingBrake-parkingBrake": {
- "type": "radio",
- "options": [{"Engaged": true}, {"Disengaged": false}]
+ "ParkingBrake-status": {
+ "type": "select",
+ "options": [{"INACTIVE": "inactive"},{"ACTIVE": "active"},
+ {"ERROR": "error"}]
},
"ParkingLight-parkingLight": {
"type": "radio",
"type": "radio",
"options": [{"Engaged": true}, {"Disengaged": false}]
},
- "AntilockBrakingSystem-antilockBrakingSystem": {
+ "AntilockBrakingSystem-engaged": {
"type": "radio",
"options":[{"Engaged": true}, {"Idle": false}]
},
- "TractionControlSystem-tractionControlSystem": {
+ "TractionControlSystem-enabled": {
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
"type": "radio",
"options": [{"On": true}, {"Off": false}]
},
- "AirbagStatus-airbagStatus": {
- "type": "select",
- "options": [{"INACTIVE": 0},{"ACTIVE": 1},{"DEPLOYED": 2}]
+ "AirbagStatus-activated": {
+ "type": "radio",
+ "options": [{"INACTIVE": false}, {"ACTIVE": true}]
},
"DoorStatus-doorStatus": {
"type": "select",
"ObstacleDistance-obstacleDistance": {
"type": "range"
},
- "NightMode-nightMode": {
+ "NightMode-mode": {
"type": "radio",
"options": [{"Night": true}, {"Day": false}]
},
- "DrivingMode-drivingMode": {
- "type": "select",
- "options": [{"Not Driving": 0},{"Driving": 1}]
+ "DrivingMode-mode": {
+ "type": "radio",
+ "options": [{"Driving": true}, {"No Driving": false}]
},
"Fluid-transmission": {
"type": "range"
"Fluid-washer": {
"type": "range"
},
- "Battery-voltage": {
+ "BatteryStatus-voltage": {
"type": "range"
},
- "Battery-current": {
+ "BatteryStatus-current": {
"type": "range"
},
"TirePressure-leftFront": {
//attributes units
_vehicleMapStack.vehiclePropertyUnitsMap = {
- "VehicleSpeed-vehicleSpeed": "kph",
- "EngineSpeed-engineSpeed": "rpm",
+ "VehicleSpeed-speed": "kph",
+ "WheelSpeed-speed": "m/h",
+ "EngineSpeed-speed": "rpm",
"TripMeter-tripMeters": "[m,...]",
"CruiseControlStatus-speed": "kph",
"Fuel-level": "%",
"Fuel-instantConsumption": "ml/s",
- "Fuel-instantEconomy": "km/l",
- "Fuel-averageEconomy": "km/l",
+ "Fuel-vehicleTimeSinceRestart": "km/l",
+ "Fuel-fuelConsumedSinceRestart": "km/l",
"EngineOil-remaining": "%",
"EngineOil-temperature": "C",
"EngineOil-pressure": "kpa",
"ExteriorBrightness-exteriorBrightness": "lux",
- "Temperature-interior": "C",
- "Temperature-exterior": "C",
- "HVAC-targetTemperature": "C",
+ "Temperature-interiorTemperature": "C",
+ "Temperature-exteriorTemperature": "C",
+ "ClimateControl-targetTemperature": "C",
"Sunroof-openness": "%",
"Sunroof-tilt": "%",
- "ConvertibleRoof-openness": "%",
"WindowStatus-openness": "%",
"ObstacleDistance-obstacleDistance": "m",
- "Size-width": "mm",
- "Size-height": "mm",
- "Size-length": "mm",
+ "SizeConfiguration-width": "mm",
+ "SizeConfiguration-height": "mm",
+ "SizeConfiguration-length": "mm",
"WheelInformation-frontWheelRadius": "mm",
"WheelInformation-rearWheelRadius": "mm",
"WheelInformation-wheelTrack": "mm",
- "Odometer-odometer": "km",
+ "Odometer-distanceTotal": "km",
"Fluid-transmission": "%",
"Fluid-brake": "%",
"Fluid-washer": "%",
- "Battery-voltage": "V",
- "Battery-current": "A",
+ "BatteryStatus-voltage": "V",
+ "BatteryStatus-current": "A",
"TirePressure-leftFront": "kpa",
"TirePressure-rightFront": "kpa",
"TirePressure-leftRear": "kpa",
"TireTemperature-rightFront": "C",
"TireTemperature-leftRear": "C",
"TireTemperature-rightRear": "C",
- "VehicleTopSpeedLimit-vehicleTopSpeedLimit": "kph"
+ "VehicleTopSpeedLimit-vehicleTopSpeedLimit": "kph",
+ "SteeringWheel-angle": "deg",
+ "ThrottlePosition-value": "%",
+ "EngineCoolant-level": "%",
+ "EngineCoolant-temperature": "C"
};
//key and value of select types in attributes
_vehicleMapStack.vehiclePropertyConstantsMap = {
- "FuelInfo": {
- "type": {
+ "FuelConfiguration": {
+ "fuelType": {
"val0": "GASOLINE",
"val1": "HIGH_OCTANE",
"val2": "DIESEL",
"val5": "TRUCK"
}
},
- "TransmissionGearType": {
+ "TransmissionConfiguration": {
"transmissionGearType": {
"val0": "AUTO",
"val1": "MANUAL",
"val2": "CV"
}
},
- "VehiclePowerMode": {
- "vehiclePowerMode": {
- "val0": "OFF",
- "val1": "ACCESSORY1",
- "val2": "ACCESSORY2",
- "val3": "RUN"
+ "VehiclePowerModeType": {
+ "value": {
+ "val0": "off",
+ "val1": "accessory1",
+ "val2": "accessory2",
+ "val3": "running"
}
}
};
};
});
+define('ripple/platform/ivi/3.0/Zone', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (pro) {
+ var zn = {};
+
+ pro = pro ? pro : {};
+ zn.value = pro.value || [];
+ zn.driver = pro.driver || {};
+
+ this.__defineGetter__("value", function () {
+ return zn.value;
+ });
+
+ this.__defineSetter__("value", function (val) {
+ try {
+ zn.value = t.DOMString(val, "[]");
+ }
+ catch (err) {
+ }
+ });
+
+ this.__defineGetter__("driver", function () {
+ return zn.driver;
+ });
+
+ this.contains = function (zone) {
+ var i;
+
+ for (i = 0; i < zone.value.length; i++) {
+ if (this.value.indexOf(zone.value[i]) > -1) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ this.equals = function (zone) {
+ var i;
+
+ if (zone.value.length !== this.value.length) {
+ return false;
+ }
+
+ for (i = 0; i < zone.value.length; i++) {
+ if (this.value.indexOf(zone.value[i]) === -1) {
+ return false;
+ }
+ }
+ return true;
+ };
+};
+
+});
define('ripple/platform/ivi/3.0/dbinit', function (require, exports, module) {
/*
* Copyright 2013 Intel Corporation.
SpeechGrammar: {
path: "ivi/3.0/SpeechGrammar"
},
+ Zone: {
+ path: "ivi/3.0/Zone"
+ },
navigator: {
path: "tizen/2.0/navigator",
children: {
long_long: "long long",
unsigned_long: "unsigned long",
unsigned_long_long: "unsigned long long",
- unsigned_short: "unsigned short"
+ unsigned_short: "unsigned short",
+
+ // Vehicle
+ TransmissionMode: ["park", "reverse", "neutral", "low",
+ "drive", "overdrive"],
+ DoorOpenStatus: ["open", "ajar", "closed"],
+ AirflowDirection: ["frontpanel", "floorduct", "bilevel",
+ "defrostfloor"],
+ VehicleTypeEnum: [ "passengerCarMini",
+ "passengerCarLight",
+ "passengerCarCompact",
+ "passengerCarMedium",
+ "passengerCarHeavy",
+ "sportUtilityVehicle", "pickupTruck",
+ "van"],
+ TransmissionGearTypeEnum: ["auto", "manual"],
+ FuelTypeEnum: ["gasoline", "methanol", "ethanol",
+ "diesel", "lpg", "cng", "electric"],
+ VehiclePowerMode: ["off", "accessory1", "accessory2",
+ "running"],
+ ConvertibleRoofStatus: ["closed", "closing", "opening",
+ "opened"],
+ ParkingBrakeStatus: ["inactive", "active", "error"]
};
/*
* VehicleSpeed
*/
_t.VehicleSpeed = {
- vehicleSpeed: _t.unsigned_long
+ speed: _t.unsigned_short
+};
+
+/*
+ * WheelSpeed
+ */
+_t.WheelSpeed = {
+ speed: _t.unsigned_short
};
/*
* EngineSpeed
*/
_t.EngineSpeed = {
- engineSpeed: _t.unsigned_long
+ speed: _t.unsigned_long
};
/*
- * VehiclePowerMode
+ * VehiclePowerModeType
*/
-_t.VehiclePowerMode = {
- vehiclePowerMode: _t.octet
+_t.VehiclePowerModeType = {
+ value: _t.VehiclePowerMode
};
/*
* Transmission
*/
_t.Transmission = {
- gearPosition: _t.octet,
- mode: _t.octet
+ gear: _t.octet,
+ mode: _t.TransmissionMode
};
/*
fog: _t.boolean,
hazard: _t.boolean,
parking: _t.boolean,
- highBeam: _t.boolean
+ highBeam: _t.boolean,
+ automaticHeadlights: _t.boolean,
+ dynamicHighBeam: _t.boolean,
+ zone: _t.unsigned_short
};
/*
* Horn
*/
_t.Horn = {
- on: _t.boolean
+ status: _t.boolean
};
/*
*/
_t.Fuel = {
level: _t.unsigned_short,
- range: _t.unsigned_short,
- instantConsumption: _t.unsigned_short,
- instantEconomy: _t.unsigned_short,
- averageEconomy: _t.unsigned_short
+ range: _t.unsigned_long,
+ instantConsumption: _t.unsigned_long,
+ averageConsumption: _t.unsigned_long,
+ fuelConsumedSinceRestart: _t.unsigned_long,
+ vehicleTimeSinceRestart: _t.unsigned_long
};
/*
* Temperature
*/
_t.Temperature = {
- interior: _t.short,
- exterior: _t.short
+ interiorTemperature: _t.float,
+ exteriorTemperature: _t.float
};
/*
* RainSensor
*/
_t.RainSensor = {
- rainSensor: _t.unsigned_short
+ rain: _t.byte,
+ zone: _t.unsigned_short
};
/*
};
/*
- * HVAC
- */
-_t.HVAC = {
- airflowDirection: _t.unsigned_short,
- fanSpeed: _t.unsigned_short,
- targetTemperature: _t.unsigned_short,
- airConditioning: _t.boolean,
- airRecirculation: _t.boolean,
- heater: _t.boolean,
- steeringWheelHeater: _t.boolean,
- seatHeater: _t.boolean,
- seatCooler: _t.boolean
-};
-
-/*
* WindowStatus
*/
_t.WindowStatus = {
* Sunroof
*/
_t.Sunroof = {
- openness: _t.unsigned_short,
- tilt: _t.unsigned_short
+ openness: _t.byte,
+ tilt: _t.byte
};
/*
* ConvertibleRoof
*/
_t.ConvertibleRoof = {
- openness: _t.unsigned_short
+ status: _t.ConvertibleRoofStatus
};
/*
- * VehicleId
+ * Identification
*/
-_t.VehicleId = {
- WMI: _t.DOMString,
- VIN: _t.DOMString
+_t.Identification = {
+ WMI: _t.DOMString,
+ VIN: _t.DOMString,
+ brand: _t.DOMString,
+ model: _t.DOMString,
+ year: _t.DOMString,
+ vehicleType: _t.VehicleTypeEnum
};
/*
- * Size
+ * SizeConfiguration
*/
-_t.Size = {
- width: _t.unsigned_long,
- height: _t.unsigned_long,
- length: _t.unsigned_long
+_t.SizeConfiguration = {
+ width: _t.unsigned_short,
+ height: _t.unsigned_short,
+ length: _t.unsigned_short,
+ doorsCount: [_t.unsigned_short],
+ totalDoors: _t.unsigned_short
};
/*
- * FuelInfo
+ * FuelConfiguration
*/
-_t.FuelInfo = {
- type: _t.unsigned_short,
+_t.FuelConfiguration = {
+ fuelType: _t.FuelTypeEnum,
refuelPosition: _t.unsigned_short
};
};
/*
- * TransmissionGearType
+ * TransmissionConfiguration
*/
-_t.TransmissionGearType = {
- transmissionGearType: _t.unsigned_short
+_t.TransmissionConfiguration = {
+ transmissionGearType: _t.TransmissionGearTypeEnum
};
/*
* Odometer
*/
_t.Odometer = {
- odometer: _t.unsigned_long
+ distanceSinceStart: _t.unsigned_long,
+ distanceTotal: _t.unsigned_long
};
/*
};
/*
- * Battery
- */
-_t.Battery = {
- voltage: _t.double,
- current: _t.double
-};
-
-/*
* TirePressure
*/
_t.TirePressure = {
* ParkingBrake
*/
_t.ParkingBrake = {
- parkingBrake: _t.boolean
+ status: _t.ParkingBrakeStatus
};
/*
* AntilockBrakingSystem
*/
_t.AntilockBrakingSystem = {
- antilockBrakingSystem: _t.boolean
+ enabled: _t.boolean,
+ engaged: _t.boolean
};
/*
* TractionControlSystem
*/
_t.TractionControlSystem = {
- tractionControlSystem: _t.boolean
+ enabled: _t.boolean,
+ engaged: _t.boolean
};
/*
* AirbagStatus
*/
_t.AirbagStatus = {
- airbagStatus: _t.unsigned_short
+ activated: _t.boolean,
+ deployed: _t.boolean,
+ zone: _t.unsigned_short
};
/*
* NightMode
*/
_t.NightMode = {
- nightMode: _t.boolean
+ mode: _t.boolean
};
/*
* DrivingMode
*/
_t.DrivingMode = {
- drivingMode: _t.unsigned_short
+ mode: _t.boolean
};
/*
};
/*
- * VehiclePropertyType
+ * SteeringWheel
+ */
+_t.SteeringWheel = {
+ angle: _t.short
+};
+
+/*
+ * ThrottlePosition
+ */
+_t.ThrottlePosition = {
+ value: _t.unsigned_short
+};
+
+/*
+ * EngineCoolant
+ */
+_t.EngineCoolant = {
+ level: _t.unsigned_short,
+ temperature: _t.unsigned_short
+};
+
+/*
+ * BrakeOperation
+ */
+_t.BrakeOperation = {
+ brakePedalDepressed: _t.boolean
+};
+
+/*
+ * Tire
+ */
+_t.Tire = {
+ pressureLow: _t.boolean,
+ pressure: _t.unsigned_short,
+ temperature: _t.short,
+ zone: _t.unsigned_short
+};
+
+/*
+ * Door
+ */
+_t.Door = {
+ status: _t.DoorOpenStatus,
+ lock: _t.boolean,
+ zone: _t.unsigned_short
+};
+
+/*
+ * Defrost
*/
-_t.VehiclePropertyType = {
- time: _t.unsigned_long_long,
- zone: _t.short,
- source: _t.DOMString,
+_t.Defrost = {
+ defrostWindow: _t.boolean,
+ defrostMirrors: _t.boolean,
+ zone: _t.unsigned_short
+};
- _derived: [_t.VehicleSpeed, _t.EngineSpeed, _t.VehiclePowerMode,
+/*
+ * ClimateControl
+ */
+_t.ClimateControl = {
+ airflowDirection: _t.AirflowDirection,
+ fanSpeedLevel: _t.byte,
+ targetTemperature: _t.byte,
+ airConditioning: _t.boolean,
+ heater: _t.boolean,
+ seatHeater: _t.byte,
+ seatCooler: _t.byte,
+ airRecirculation: _t.boolean,
+ steeringWheelHeater: _t.byte,
+ zone: _t.unsigned_short
+};
+
+/*
+ * BatteryStatus
+ */
+_t.BatteryStatus = {
+ chargeLevel: _t.unsigned_short,
+ voltage: _t.unsigned_short,
+ current: _t.unsigned_short,
+ zone: _t.unsigned_short
+};
+
+/*
+ * VehicleCommonDataType
+ */
+_t.VehicleCommonDataType = {
+ timeStamp: _t.unsigned_long_long,
+
+ _derived: [_t.VehicleSpeed, _t.WheelSpeed, _t.EngineSpeed, _t.VehiclePowerModeType,
_t.TripMeter, _t.Acceleration, _t.Transmission,
_t.CruiseControlStatus, _t.WheelBrake, _t.LightStatus,
_t.InteriorLightStatus, _t.Horn, _t.Fuel, _t.EngineOil, _t.Location,
_t.ExteriorBrightness, _t.Temperature, _t.RainSensor,
- _t.WindshieldWiper, _t.HVAC, _t.WindowStatus, _t.Sunroof,
- _t.ConvertibleRoof, _t.VehicleId, _t.Size, _t.FuelInfo, _t.VehicleType,
- _t.Doors, _t.TransmissionGearType, _t.WheelInformation, _t.Odometer,
- _t.Fluid, _t.Battery, _t.TirePressure, _t.TireTemperature,
+ _t.WindshieldWiper, _t.WindowStatus, _t.Sunroof,
+ _t.ConvertibleRoof, _t.Identification, _t.SizeConfiguration, _t.FuelConfiguration, _t.VehicleType,
+ _t.Doors, _t.TransmissionConfiguration, _t.WheelInformation, _t.Odometer,
+ _t.Fluid, _t.TirePressure, _t.TireTemperature,
_t.SecurityAlert, _t.ParkingBrake, _t.ParkingLight, _t.HazardLight,
_t.AntilockBrakingSystem, _t.TractionControlSystem,
_t.VehicleTopSpeedLimit, _t.AirbagStatus, _t.DoorStatus,
_t.SeatBeltStatus, _t.OccupantStatus, _t.ObstacleDistance,
- _t.NightMode, _t.TurnSignal, _t.ButtonEvent]
+ _t.NightMode, _t.TurnSignal, _t.ButtonEvent, _t.SteeringWheel,
+ _t.ThrottlePosition, _t.EngineCoolant, _t.BrakeOperation, _t.Tire,
+ _t.Door, _t.Defrost, _t.ClimateControl, _t.BatteryStatus]
};
/*
}
};
-_i.Vehicle.getAsync = {
- 0: _t.DOMString,
- 1: _t.VehiclePropertyCallback,
- 2: _t.VehiclePropertyErrorCallback,
- 3: _t.short,
-
- _optional: {
- // nullable
- 2: true,
- 3: true
- }
+_i.Vehicle.supported = {
+ 0: _t.DOMString
};
+
_i.Vehicle.subscribe = {
0: _t.DOMString,
1: _t.VehiclePropertyCallback,
2: _t.short,
- 3: _t.VehiclePropertyErrorCallback,
_optional: {
// nullable
- 2: true,
- 3: true
+ 2: true
}
};
+_i.Vehicle.unsubscribe = {
+ 0: _t.DOMString,
+ 1: _t.unsigned_short,
+};
+
_i.Vehicle.set = {
0: _t.DOMString,
1: _t.VehiclePropertyType,
- 2: _t.VehiclePropertyErrorCallback,
+ 2: _t.short,
_optional: {
// nullable
_i.Vehicle.getHistory = {
0: _t.DOMString,
- 1: _t.short,
+ 1: _t.Date,
2: _t.Date,
- 3: _t.Date,
- 4: _t.VehiclePropertyListCallback,
- 5: _t.VehiclePropertyErrorCallback,
+ 3: _t.short,
_optional: {
// nullable
- 5: true
+ 3: true
}
};
-_i.Vehicle.listZones = {
- 0: _t.DOMString
-};
-
// Exports
_t.constructor = _c;
_t.interface = _i;
t = require('ripple/platform/ivi/3.0/typecast'),
errorcode = require('ripple/platform/ivi/3.0/errorcode'),
WebAPIError = require('ripple/platform/ivi/3.0/WebAPIError'),
- WebAPIException = require('ripple/platform/ivi/3.0/WebAPIException'),
- VehiclePropertyType,
+ TripMeter, //no
+ WheelBrake, //no
+ Location, //no
+ ExteriorBrightness, //no
+ WindshieldWiper, //no
+ WindowStatus, //no
+ VehicleType, //no
+ Doors, //no
+ WheelInformation, //no
+ Fluid, //no
+ TirePressure, //no
+ TireTemperature, //no
+ SecurityAlert, //no
+ ParkingLight, //no
+ HazardLight, //no
+ VehicleTopSpeedLimit, //no
+ DoorStatus, //no
+ SeatBeltStatus, //no
+ OccupantStatus, //no
+ ObstacleDistance, //no
+ TurnSignal, //no
+ //New Spec
+ Zone,
+ VehicleCommonDataType,
+ //Configuration and Identification Interfaces
+ Identification,
+ SizeConfiguration,
+ FuelConfiguration,
+ TransmissionConfiguration,
+ WheelConfiguration,
+ SteeringWheelConfiguration,
+ //Running Status Interfaces
VehicleSpeed,
+ WheelSpeed,
EngineSpeed,
- VehiclePowerMode,
- TripMeter,
- Acceleration,
+ VehiclePowerModeType,
+ PowerTrainTorque,
+ AcceleratorPedalPosition,
+ ThrottlePosition,
+ //TripMeters ------no work
+ Diagnostic,
Transmission,
CruiseControlStatus,
- WheelBrake,
LightStatus,
InteriorLightStatus,
Horn,
+ Chime,
Fuel,
EngineOil,
- Location,
- ExteriorBrightness,
+ Acceleration,
+ EngineCoolant,
+ SteeringWheel,
+ IgnitionTime,
+ YawRate,
+ BrakeOperation,
+ WheelTick,
+ ButtonEvent,
+ DrivingMode,
+ NightMode,
+ //Maintenance Interfaces
+ Odometer,
+ BatteryStatus,
+ Tire,
+ //DrivingSafety Interfaces
+ AntilockBrakingSystem,
+ TractionControlSystem,
+ AirbagStatus,
+ Door,
+ //Climate Interfaces
Temperature,
RainSensor,
- WindshieldWiper,
- HVAC,
- WindowStatus,
+ Defrost,
+ ClimateControl,
Sunroof,
ConvertibleRoof,
- VehicleId,
- Size,
- FuelInfo,
- VehicleType,
- Doors,
- TransmissionGearType,
- WheelInformation,
- Odometer,
- Fluid,
- Battery,
- TirePressure,
- TireTemperature,
- SecurityAlert,
+ //Vision and Parking Interfaces
ParkingBrake,
- ParkingLight,
- HazardLight,
- AntilockBrakingSystem,
- TractionControlSystem,
- VehicleTopSpeedLimit,
- AirbagStatus,
- DoorStatus,
- SeatBeltStatus,
- OccupantStatus,
- ObstacleDistance,
- NightMode,
- DrivingMode,
- TurnSignal,
- ButtonEvent,
+ //
VehicleFactory,
- _vehicleCacheData = {
- supported: null,
- data: null
- },
- _vehicleEvent = {subscribe: {}},
+ _data = {
+ nHandle: 0, //subscribe listener flag
+ supported: null, //current supported properties
+ history: [], //all properties data
+ cache: null, //current all properties data
+ },
+ _VEHICLE_PROPERTIES = ["VehicleSpeed", "EngineSpeed", "VehiclePowerModeType",
+ "TripMeter", "Acceleration", "Transmission", "CruiseControlStatus",
+ "WheelBrake", "LightStatus", "InteriorLightStatus", "Horn", "Fuel",
+ "EngineOil", "Location", "ExteriorBrightness", "Temperature",
+ "RainSensor", "WindshieldWiper", "WindowStatus", "Sunroof",
+ "ConvertibleRoof", "VehicleType",
+ "Doors", "WheelInformation", "Odometer",
+ "Fluid", "TirePressure", "TireTemperature", "SecurityAlert",
+ "ParkingBrake", "ParkingLight", "HazardLight", "AntilockBrakingSystem",
+ "TractionControlSystem", "VehicleTopSpeedLimit", "AirbagStatus",
+ "DoorStatus", "SeatBeltStatus", "OccupantStatus", "ObstacleDistance",
+ "NightMode", "DrivingMode", "TurnSignal", "ButtonEvent", "WheelTick",
+ "WheelSpeed", "SteeringWheel", "ThrottlePosition", "EngineCoolant",
+ "Identification", "SizeConfiguration", "FuelConfiguration",
+ "TransmissionConfiguration", "WheelConfiguration",
+ "SteeringWheelConfiguration", "PowerTrainTorque",
+ "AcceleratorPedalPosition", "Diagnostic", "Chime", "IgnitionTime",
+ "YawRate", "BrakeOperation", "Tire", "Door", "Defrost",
+ "ClimateControl", "BatteryStatus"],
_security = {
- "http://tizen.org/privilege/vehicle": ["supported", "get", "getAsync",
- "set", "getHistory", "subscribe", "listZones"]
+ "http://tizen.org/privilege/vehicle": []
},
_self;
function _initialize () {
+ _data.history.length = 0;
event.on("vehicle-cache-refresh", function (supported, data) {
- _vehicleCacheData.supported = supported;
- _vehicleCacheData.data = data;
+ _data.supported = supported;
+ _data.cache = data;
+ _data.history.push(data);
});
- event.trigger("vehicle-cache-request", [_vehicleCacheData]);
+ event.trigger("vehicle-cache-request", [_data]);
}
+event.on("vehicle-subscribe-response", function(propertyObj) {
+ var property = propertyObj.type, success, handle, value;
+
+ if (_data[property]) {
+ for (handle in _data[property]) {
+ success = _data[property][handle];
+ value = new VehicleFactory(property, propertyObj.val);
+
+ success(value);
+ }
+ }
+});
+
_self = function () {
var vehicle;
- function supported () {
- if (!_security.supported) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
- }
+ function _subscribe(property, success, zone) {
+ var handle = ++_data.nHandle,
+ key = "subscribe" + handle;
- return _vehicleCacheData.supported;
- }
+ zone = zone ? zone : 0;
+ t.Vehicle("subscribe", arguments);
- function get (property, zone) {
- if (!_security.get) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ if (!_data[property]) {
+ _data[property] = {};
}
- t.Vehicle("get", arguments);
+ _data[property][key] = success;
- if (_vehicleCacheData.supported.indexOf(property) === -1) {
- throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
- }
+ // Need complete
+ event.trigger("vehicle-subscribe-request", [property, true, zone]);
- return new VehicleFactory(property, _vehicleCacheData.data[property]);
+ return handle;
}
- function getAsync (property, successCallback, errorCallback, zone) {
- if (!_security.getAsync) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
- }
+ function _unsubscribe(property, handle) {
+ var key = "subscribe" + handle;
- t.Vehicle("getAsync", arguments);
+ t.Vehicle("unsubscribe", arguments);
- if (_vehicleCacheData.supported.indexOf(property) === -1) {
- throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
- }
+ if (_data[property] && _data[property][key])
+ delete _data[property][key];
- window.setTimeout(function () {
- successCallback(new VehicleFactory(property,
- _vehicleCacheData.data[property]));
- }, 1);
+ return;
}
- function subscribe (property, successCallback, zone, errorCallback) {
- if (!_security.subscribe) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ function _get(property, zone) {
+ zone = zone ? zone : 0;
+ t.Vehicle("get", arguments);
+
+ if (_data.supported.indexOf(property) === -1) {
+ return;
}
- t.Vehicle("subscribe", arguments);
+ return {
+ then: function (resolve) {
+ var data = new VehicleFactory(property,
+ _data.cache[property]);
+ resolve(data);
+ }
+ };
+ }
- if (_vehicleCacheData.supported.indexOf(property) === -1) {
- throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ function _getHistory(property, begin, end, zone) {
+ zone = zone ? zone : 0;
+ t.Vehicle("getHistory", arguments);
+
+ if (_data.supported.indexOf(property) === -1) {
+ return;
}
- _vehicleEvent.subscribe[property] = {
- successCallback: successCallback,
- errorCallback: errorCallback
- };
+ begin = begin.getTime();
+ end = end.getTime();
- window.setTimeout(function () {
- if (! _vehicleEvent["vehicle-subscribe-response"]) {
- event.on("vehicle-subscribe-response", function (propertyObj) {
- var propertySub = _vehicleEvent.subscribe[propertyObj.type],
- success = propertySub.successCallback,
- error = propertySub.errorCallback;
-
- if (!propertyObj.supported) {
- if (error) {
- error(new WebAPIError(
- errorcode.PROPERTY_UNAVAILABLE));
+ return {
+ then: function (resolve) {
+ var data = [], i, time;
+
+ for ( i = 0; i < _data.history.length; i++) {
+ if (_data.history[i][property]) {
+ time = _data.history[i][property].time;
+ if (time >= begin && time <= end) {
+ data.push(new VehicleFactory(property,
+ _data.history[i][property]));
}
- return;
}
-
- success(new VehicleFactory(propertyObj.type,
- propertyObj.val));
-
- });
- _vehicleEvent["vehicle-subscribe-response"] = true;
+ }
+ resolve(data);
}
- event.trigger("vehicle-subscribe-request", [property, true, zone]);
- }, 1);
+ };
}
- function set (property, value, errorCallback) {
+ function _set(property, value, zone) {
var val = utils.copy(value);
- if (!_security.set) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
- }
-
+ zone = zone ? zone : 0;
t.Vehicle("set", arguments);
- if (_vehicleCacheData.supported.indexOf(property) === -1) {
- throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ if (_data.supported.indexOf(property) === -1) {
+ return;
}
- window.setTimeout(function () {
- event.once("vehicle-set-response", function (status) {
- if (!status) {
- if (errorCallback) {
- errorCallback(new WebAPIError(
- errorcode.PROPERTY_UNAVAILABLE));
+ return {
+ then: function (resolve, reject) {
+ event.once("vehicle-set-response", function (status) {
+ if (!status) {
+ reject(new WebAPIError(
+ errorcode.PROPERTY_UNAVAILABLE));
+ return;
}
- }
- });
- event.trigger("vehicle-set-request", [property, val]);
- }, 1);
+ resolve();
+ });
+ event.trigger("vehicle-set-request", [property, val]);
+ }
+ };
}
- function getHistory (property, zone, startTime, endTime, successCallback,
- errorCallback) {
- var properties = [], i;
-
- if (!_security.getHistory) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
- }
-
- t.Vehicle("getHistory", arguments);
+ function _supported(property) {
+ t.Vehicle("supported", arguments);
- if (_vehicleCacheData.supported.indexOf(property) === -1) {
- throw new WebAPIException(errorcode.PROPERTY_UNAVAILABLE);
+ if (_data.supported.indexOf(property) === -1) {
+ return false;
}
- startTime = startTime.getTime();
- endTime = endTime.getTime();
-
- window.setTimeout(function () {
- event.once("vehicle-history-response", function (values, status) {
- if (!status) {
- if (errorCallback) {
- errorCallback(new WebAPIError(
- errorcode.PROPERTY_UNAVAILABLE));
- }
- return;
- }
-
- for (i = 0; i < values.length; i++) {
- properties.push(new VehicleFactory(property, values[i]));
- }
- successCallback(properties);
- });
- event.trigger("vehicle-history-request", [property, zone,
- startTime, endTime]);
- }, 1);
+ return true;
}
- function listZones (property) {
- if (!_security.listZones) {
- throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ function _buildPropertiesAPIs() {
+ var i, propertyName, propertyKey;
+ for (i = 0; i < _VEHICLE_PROPERTIES.length; i++) {
+ propertyName = _VEHICLE_PROPERTIES[i];
+ propertyKey = propertyName.substring(0, 1).toLowerCase() +
+ propertyName.substring(1);
+
+ // Initialize
+ vehicle[propertyKey] = {};
+ (function(property){
+ // No complete
+ vehicle[propertyKey].zones = [];
+ vehicle[propertyKey].isLogged = true;
+ vehicle[propertyKey].from = null;
+ vehicle[propertyKey].to = null;
+
+ // function
+ vehicle[propertyKey].subscribe = function (success, zone) {
+ return _subscribe(property, success, zone);
+ };
+ vehicle[propertyKey].unsubscribe = function (handle) {
+ return _unsubscribe(property, handle);
+ };
+ vehicle[propertyKey].get = function () {
+ return _get(property);
+ };
+ vehicle[propertyKey].getHistory = function (begin, end, zone) {
+ return _getHistory(property, begin, end, zone);
+ };
+ vehicle[propertyKey].set = function (obj, zone) {
+ return _set(property, obj, zone);
+ };
+ vehicle[propertyKey].supported = function () {
+ return _supported(property);
+ };
+ // No complete
+ vehicle[propertyKey].availabilityChangedListener = function (fun) {
+ return 0;
+ };
+ vehicle[propertyKey].availableForRetrieval = function (attr) {
+ return null;
+ };
+ vehicle[propertyKey].removeAvailabilityChangedListener = function (handle) {
+ return;
+ };
+ vehicle[propertyKey].availableForSubscription = function (attr) {
+ return;
+ };
+ vehicle[propertyKey].availableForSetting = function (attr) {
+ return;
+ };
+ })(propertyName);
}
-
- t.Vehicle("listZones", arguments);
-
- return [0];
}
function handleSubFeatures (subFeatures) {
}
vehicle = {
- supported: supported,
- get: get,
- getAsync: getAsync,
- subscribe: subscribe,
- set: set,
- getHistory: getHistory,
- listZones: listZones,
handleSubFeatures: handleSubFeatures
};
-
- vehicle.__defineGetter__("ZONE_None", function () {
- return 0;
- });
-
- vehicle.__defineGetter__("ZONE_Front", function () {
- return 0x01;
- });
-
- vehicle.__defineGetter__("ZONE_Middle", function () {
- return 0x02;
- });
-
- vehicle.__defineGetter__("ZONE_Right", function () {
- return 0x04;
- });
-
- vehicle.__defineGetter__("ZONE_Left", function () {
- return 0x08;
- });
-
- vehicle.__defineGetter__("ZONE_Rear", function () {
- return 0x10;
- });
-
- vehicle.__defineGetter__("ZONE_Center", function () {
- return 0x20;
- });
+ _buildPropertiesAPIs();
return vehicle;
};
var instanceType;
switch (vehicleType) {
- case "VehicleSpeed":
- instanceType = new VehicleSpeed(value);
- break;
- case "EngineSpeed":
- instanceType = new EngineSpeed(value);
- break;
- case "VehiclePowerMode":
- instanceType = new VehiclePowerMode(value);
- break;
case "TripMeter":
instanceType = new TripMeter(value);
break;
- case "Acceleration":
- instanceType = new Acceleration(value);
- break;
- case "Transmission":
- instanceType = new Transmission(value);
- break;
- case "CruiseControlStatus":
- instanceType = new CruiseControlStatus(value);
- break;
case "WheelBrake":
instanceType = new WheelBrake(value);
break;
- case "LightStatus":
- instanceType = new LightStatus(value);
- break;
- case "InteriorLightStatus":
- instanceType = new InteriorLightStatus(value);
- break;
- case "Horn":
- instanceType = new Horn(value);
- break;
- case "Fuel":
- instanceType = new Fuel(value);
- break;
- case "EngineOil":
- instanceType = new EngineOil(value);
- break;
case "Location":
instanceType = new Location(value);
break;
case "ExteriorBrightness":
instanceType = new ExteriorBrightness(value);
break;
- case "Temperature":
- instanceType = new Temperature(value);
- break;
- case "RainSensor":
- instanceType = new RainSensor(value);
- break;
case "WindshieldWiper":
instanceType = new WindshieldWiper(value);
break;
- case "HVAC":
- instanceType = new HVAC(value);
- break;
case "WindowStatus":
instanceType = new WindowStatus(value);
break;
- case "Sunroof":
- instanceType = new Sunroof(value);
- break;
case "ConvertibleRoof":
instanceType = new ConvertibleRoof(value);
break;
- case "VehicleId":
- instanceType = new VehicleId(value);
- break;
- case "Size":
- instanceType = new Size(value);
- break;
- case "FuelInfo":
- instanceType = new FuelInfo(value);
- break;
case "VehicleType":
instanceType = new VehicleType(value);
break;
case "Doors":
instanceType = new Doors(value);
break;
- case "TransmissionGearType":
- instanceType = new TransmissionGearType(value);
- break;
case "WheelInformation":
instanceType = new WheelInformation(value);
break;
- case "Odometer":
- instanceType = new Odometer(value);
- break;
case "Fluid":
instanceType = new Fluid(value);
break;
- case "Battery":
- instanceType = new Battery(value);
- break;
case "TirePressure":
instanceType = new TirePressure(value);
break;
case "SecurityAlert":
instanceType = new SecurityAlert(value);
break;
- case "ParkingBrake":
- instanceType = new ParkingBrake(value);
- break;
case "ParkingLight":
instanceType = new ParkingLight(value);
break;
case "HazardLight":
instanceType = new HazardLight(value);
break;
- case "AntilockBrakingSystem":
- instanceType = new AntilockBrakingSystem(value);
- break;
- case "TractionControlSystem":
- instanceType = new TractionControlSystem(value);
- break;
case "VehicleTopSpeedLimit":
instanceType = new VehicleTopSpeedLimit(value);
break;
case "ObstacleDistance":
instanceType = new ObstacleDistance(value);
break;
- case "NightMode":
- instanceType = new NightMode(value);
- break;
- case "DrivingMode":
- instanceType = new DrivingMode(value);
- break;
case "TurnSignal":
instanceType = new TurnSignal(value);
break;
+ //configuration
+ case "Identification":
+ instanceType = new Identification(value);
+ break;
+ case "SizeConfiguration":
+ instanceType = new SizeConfiguration(value);
+ break;
+ case "FuelConfiguration":
+ instanceType = new FuelConfiguration(value);
+ break;
+ case "TransmissionConfiguration":
+ instanceType = new TransmissionConfiguration(value);
+ break;
+ case "WheelConfiguration":
+ instanceType = new WheelConfiguration(value);
+ break;
+ case "SteeringWheelConfiguration":
+ instanceType = new SteeringWheelConfiguration(value);
+ break;
+ //signal
+ case "VehicleSpeed":
+ instanceType = new VehicleSpeed(value);
+ break;
+ case "WheelSpeed":
+ instanceType = new WheelSpeed(value);
+ break;
+ case "EngineSpeed":
+ instanceType = new EngineSpeed(value);
+ break;
+ case "VehiclePowerModeType":
+ instanceType = new VehiclePowerModeType(value);
+ break;
+ case "PowerTrainTorque":
+ instanceType = new PowerTrainTorque(value);
+ break;
+ case "AcceleratorPedalPosition":
+ instanceType = new AcceleratorPedalPosition(value);
+ break;
+ case "ThrottlePosition":
+ instanceType = new ThrottlePosition(value);
+ break;
+ case "Diagnostic":
+ instanceType = new Diagnostic(value);
+ break;
+ case "Transmission":
+ instanceType = new Transmission(value);
+ break;
+ case "CruiseControlStatus":
+ instanceType = new CruiseControlStatus(value);
+ break;
+ case "LightStatus":
+ instanceType = new LightStatus(value);
+ break;
+ case "InteriorLightStatus":
+ instanceType = new InteriorLightStatus(value);
+ break;
+ case "Horn":
+ instanceType = new Horn(value);
+ break;
+ case "Chime":
+ instanceType = new Chime(value);
+ break;
+ case "Fuel":
+ instanceType = new Fuel(value);
+ break;
+ case "EngineOil":
+ instanceType = new EngineOil(value);
+ break;
+ case "Acceleration":
+ instanceType = new Acceleration(value);
+ break;
+ case "EngineCoolant":
+ instanceType = new EngineCoolant(value);
+ break;
+ case "SteeringWheel":
+ instanceType = new SteeringWheel(value);
+ break;
+ case "IgnitionTime":
+ instanceType = new IgnitionTime(value);
+ break;
+ case "YawRate":
+ instanceType = new YawRate(value);
+ break;
+ case "BrakeOperation":
+ instanceType = new BrakeOperation(value);
+ break;
+ case "WheelTick":
+ instanceType = new WheelTick(value);
+ break;
case "ButtonEvent":
instanceType = new ButtonEvent(value);
break;
+ case "DrivingMode":
+ instanceType = new DrivingMode(value);
+ break;
+ case "NightMode":
+ instanceType = new NightMode(value);
+ break;
+ //
+ case "Odometer":
+ instanceType = new Odometer(value);
+ break;
+ case "BatteryStatus":
+ instanceType = new BatteryStatus(value);
+ break;
+ case "Tire":
+ instanceType = new Tire(value);
+ break;
+ //
+ case "AntilockBrakingSystem":
+ instanceType = new AntilockBrakingSystem(value);
+ break;
+ case "TractionControlSystem":
+ instanceType = new TractionControlSystem(value);
+ break;
+ case "Door":
+ instanceType = new Door(value);
+ break;
+ //
+ case "Temperature":
+ instanceType = new Temperature(value);
+ break;
+ case "RainSensor":
+ instanceType = new RainSensor(value);
+ break;
+ case "Defrost":
+ instanceType = new Defrost(value);
+ break;
+ case "ClimateControl":
+ instanceType = new ClimateControl(value);
+ break;
+ case "Sunroof":
+ instanceType = new Sunroof(value);
+ break;
+ //
+ case "ParkingBrake":
+ instanceType = new ParkingBrake(value);
+ break;
}
function _construct () {
return _construct();
};
-VehiclePropertyType = function (propertyTypes) {
- var vehiclePropertyType = {};
-
- vehiclePropertyType.time = propertyTypes.time || undefined;
- vehiclePropertyType.zone = propertyTypes.zone || 0;
- vehiclePropertyType.source = propertyTypes.source || "";
-
- this.__defineGetter__("time", function () {
- return vehiclePropertyType.time;
- });
-
- this.__defineSetter__("time", function (val) {
- try {
- vehiclePropertyType.time = t.unsigned_long_long(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("zone", function () {
- return vehiclePropertyType.zone;
- });
-
- this.__defineSetter__("zone", function (val) {
- try {
- vehiclePropertyType.zone = t.short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("source", function () {
- return vehiclePropertyType.source;
- });
-
- this.__defineSetter__("source", function (val) {
- try {
- vehiclePropertyType.source = t.DOMString(val);
- } catch (err) {
- }
- });
-};
-
-VehicleSpeed = function (propertyTypes) {
- var vehicleSpeed = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- vehicleSpeed.vehicleSpeed = propertyTypes.vehicleSpeed || 0;
-
- this.__defineGetter__("vehicleSpeed", function () {
- return vehicleSpeed.vehicleSpeed;
- });
-
- this.__defineSetter__("vehicleSpeed", function (val) {
- try {
- vehicleSpeed.vehicleSpeed = t.unsigned_long(val);
- } catch (err) {
- }
- });
-};
-
-EngineSpeed = function (propertyTypes) {
- var engineSpeed = {};
-
- VehiclePropertyType.call(this, propertyTypes);
+VehicleCommonDataType = function (propertyTypes) {
+ var commonData = {};
- engineSpeed.engineSpeed = propertyTypes.engineSpeed || 0;
+ commonData.timeStamp = propertyTypes.timeStamp || null;
- this.__defineGetter__("engineSpeed", function () {
- return engineSpeed.engineSpeed;
- });
-
- this.__defineSetter__("engineSpeed", function (val) {
- try {
- engineSpeed.engineSpeed = t.unsigned_long(val);
- } catch (err) {
- }
+ this.__defineGetter__("timeStamp", function () {
+ return commonData.timeStamp;
});
};
-VehiclePowerMode = function (propertyTypes) {
+VehiclePowerModeType = function (propertyTypes) {
var vehiclePowerMode = {};
- VehiclePropertyType.call(this, propertyTypes);
-
- vehiclePowerMode.vehiclePowerMode = propertyTypes.vehiclePowerMode || 0;
+ VehicleCommonDataType.call(this, propertyTypes);
- this.__defineGetter__("VEHICLEPOWERMODE_OFF", function () {
- return 0;
- });
+ vehiclePowerMode.value = propertyTypes.value || "off";
- this.__defineGetter__("VEHICLEPOWERMODE_ACCESSORY1", function () {
- return 1;
- });
-
- this.__defineGetter__("VEHICLEPOWERMODE_ACCESSORY2", function () {
- return 2;
- });
-
- this.__defineGetter__("VEHICLEPOWERMODE_RUN", function () {
- return 3;
- });
-
- this.__defineGetter__("vehiclePowerMode", function () {
- return vehiclePowerMode.vehiclePowerMode;
- });
-
- this.__defineSetter__("vehiclePowerMode", function (val) {
- try {
- val = t.octet(val);
- if (val < 0 || val > 3) {
- return;
- }
- vehiclePowerMode.vehiclePowerMode = val;
- } catch (err) {
- }
+ this.__defineGetter__("value", function () {
+ return vehiclePowerMode.value;
});
};
TripMeter = function (propertyTypes) {
var tripMeter = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
tripMeter.tripMeters = propertyTypes.tripMeters || [];
});
};
-Acceleration = function (propertyTypes) {
- var acceleration = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- acceleration.x = propertyTypes.x || 0;
- acceleration.y = propertyTypes.y || 0;
- acceleration.z = propertyTypes.z || 0;
-
- this.__defineGetter__("x", function () {
- return acceleration.x;
- });
-
- this.__defineSetter__("x", function (val) {
- try {
- acceleration.x = t.unsigned_long(val);
- }
- catch (err) {
- }
- });
-
- this.__defineGetter__("y", function () {
- return acceleration.y;
- });
-
- this.__defineSetter__("y", function (val) {
- try {
- acceleration.y = t.unsigned_long(val);
- }
- catch (err) {
- }
- });
-
- this.__defineGetter__("z", function () {
- return acceleration.z;
- });
-
- this.__defineSetter__("z", function (val) {
- try {
- acceleration.z = t.unsigned_long(val);
- } catch (err) {
- }
- });
-};
-
-Transmission = function (propertyTypes) {
- var transmission = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- transmission.gearPosition = propertyTypes.gearPosition || 0;
- transmission.mode = propertyTypes.mode || 0;
-
- this.__defineGetter__("TRANSMISSIONPOSITION_NEUTRAL", function () {
- return 0;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_FIRST", function () {
- return 1;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_SECOND", function () {
- return 2;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_THIRD", function () {
- return 3;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_FORTH", function () {
- return 4;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_FIFTH", function () {
- return 5;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_SIXTH", function () {
- return 6;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_SEVENTH", function () {
- return 7;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_EIGHTH", function () {
- return 8;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_NINTH", function () {
- return 9;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_TENTH", function () {
- return 10;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_CVT", function () {
- return 64;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_REVERSE", function () {
- return 128;
- });
-
- this.__defineGetter__("TRANSMISSIONPOSITION_PARK", function () {
- return 255;
- });
-
- this.__defineGetter__("TRANSMISSIONMODE_NORMAL", function () {
- return 0;
- });
-
- this.__defineGetter__("TRANSMISSIONMODE_SPORT", function () {
- return 1;
- });
-
- this.__defineGetter__("TRANSMISSIONMODE_ECONOMY", function () {
- return 2;
- });
-
- this.__defineGetter__("TRANSMISSIONMODE_OEMCUSTOM1", function () {
- return 3;
- });
-
- this.__defineGetter__("TRANSMISSIONMODE_OEMCUSTOM2", function () {
- return 4;
- });
-
- this.__defineGetter__("gearPosition", function () {
- return transmission.gearPosition;
- });
-
- this.__defineSetter__("gearPosition", function (val) {
- try {
- val = t.octet(val);
- if ((val >= 0 && val <= 10) || val === 64 || val === 128 ||
- val === 255) {
- transmission.gearPosition = val;
- }
- } catch (err) {
- }
- });
-
- this.__defineGetter__("mode", function () {
- return transmission.mode;
- });
-
- this.__defineSetter__("mode", function (val) {
- try {
- val = t.octet(val);
- if (val < 0 || val > 4) {
- return;
- }
- transmission.mode = val;
- } catch (err) {
- }
- });
-};
-
-CruiseControlStatus = function (propertyTypes) {
- var cruiseControlStatus = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- cruiseControlStatus.activated = propertyTypes.activated || false;
- cruiseControlStatus.speed = propertyTypes.speed || 0;
-
- this.__defineGetter__("activated", function () {
- return cruiseControlStatus.activated;
- });
-
- this.__defineSetter__("activated", function (val) {
- try {
- cruiseControlStatus.activated = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("speed", function () {
- return cruiseControlStatus.speed;
- });
-
- this.__defineSetter__("speed", function (val) {
- try {
- cruiseControlStatus.speed = t.unsigned_short(val);
- } catch (err) {
- }
- });
-};
-
WheelBrake = function (propertyTypes) {
var wheelBrake = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
wheelBrake.engaged = propertyTypes.engaged || false;
});
};
-LightStatus = function (propertyTypes) {
- var lightStatus = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- lightStatus.head = propertyTypes.head || false;
- lightStatus.rightTurn = propertyTypes.rightTurn || false;
- lightStatus.leftTurn = propertyTypes.leftTurn || false;
- lightStatus.brake = propertyTypes.brake || false;
- lightStatus.fog = propertyTypes.fog || false;
- lightStatus.hazard = propertyTypes.hazard || false;
- lightStatus.parking = propertyTypes.parking || false;
- lightStatus.highBeam = propertyTypes.highBeam || false;
-
- this.__defineGetter__("head", function () {
- return lightStatus.head;
- });
-
- this.__defineSetter__("head", function (val) {
- try {
- lightStatus.head = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("rightTurn", function () {
- return lightStatus.rightTurn;
- });
-
- this.__defineSetter__("rightTurn", function (val) {
- try {
- lightStatus.rightTurn = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("leftTurn", function () {
- return lightStatus.leftTurn;
- });
-
- this.__defineSetter__("leftTurn", function (val) {
- try {
- lightStatus.leftTurn = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("brake", function () {
- return lightStatus.brake;
- });
-
- this.__defineSetter__("brake", function (val) {
- try {
- lightStatus.brake = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("fog", function () {
- return lightStatus.fog;
- });
-
- this.__defineSetter__("fog", function (val) {
- try {
- lightStatus.fog = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("hazard", function () {
- return lightStatus.hazard;
- });
-
- this.__defineSetter__("hazard", function (val) {
- try {
- lightStatus.hazard = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("parking", function () {
- return lightStatus.parking;
- });
-
- this.__defineSetter__("parking", function (val) {
- try {
- lightStatus.parking = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("highBeam", function () {
- return lightStatus.highBeam;
- });
-
- this.__defineSetter__("highBeam", function (val) {
- try {
- lightStatus.highBeam = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
-InteriorLightStatus = function (propertyTypes) {
- var interiorLightStatus = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- interiorLightStatus.passenger = propertyTypes.passenger || false;
- interiorLightStatus.driver = propertyTypes.driver || false;
- interiorLightStatus.center = propertyTypes.center || false;
-
- this.__defineGetter__("passenger", function () {
- return interiorLightStatus.passenger;
- });
-
- this.__defineSetter__("passenger", function (val) {
- try {
- interiorLightStatus.passenger = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("driver", function () {
- return interiorLightStatus.driver;
- });
-
- this.__defineSetter__("driver", function (val) {
- try {
- interiorLightStatus.driver = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("center", function () {
- return interiorLightStatus.center;
- });
-
- this.__defineSetter__("center", function (val) {
- try {
- interiorLightStatus.center = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
Horn = function (propertyTypes) {
var horn = {};
- VehiclePropertyType.call(this, propertyTypes);
-
- horn.on = propertyTypes.on || false;
-
- this.__defineGetter__("on", function () {
- return horn.on;
- });
-
- this.__defineSetter__("on", function (val) {
- try {
- horn.on = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
-Fuel = function (propertyTypes) {
- var fuel = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- fuel.level = propertyTypes.level || 0;
- fuel.range = propertyTypes.range || 0;
- fuel.instantConsumption = propertyTypes.instantConsumption || 0;
- fuel.instantEconomy = propertyTypes.instantEconomy || 0;
- fuel.averageEconomy = propertyTypes.averageEconomy || 0;
-
- this.__defineGetter__("level", function () {
- return fuel.level;
- });
-
- this.__defineSetter__("level", function (val) {
- try {
- fuel.level = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("range", function () {
- return fuel.range;
- });
-
- this.__defineSetter__("range", function (val) {
- try {
- fuel.range = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("instantConsumption", function () {
- return fuel.instantConsumption;
- });
-
- this.__defineSetter__("instantConsumption", function (val) {
- try {
- fuel.instantConsumption = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("instantEconomy", function () {
- return fuel.instantEconomy;
- });
-
- this.__defineSetter__("instantEconomy", function (val) {
- try {
- fuel.instantEconomy = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("averageEconomy", function () {
- return fuel.averageEconomy;
- });
-
- this.__defineSetter__("averageEconomy", function (val) {
- try {
- //Setting this to any value should reset the counter to '0'
- fuel.averageEconomy = t.unsigned_short(val);
- } catch (err) {
- }
- });
-};
-
-EngineOil = function (propertyTypes) {
- var engineOil = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- engineOil.remaining = propertyTypes.remaining || 0;
- engineOil.temperature = propertyTypes.temperature || 0;
- engineOil.pressure = propertyTypes.Pressure || 0;
-
- this.__defineGetter__("remaining", function () {
- return engineOil.remaining;
- });
-
- this.__defineSetter__("remaining", function (val) {
- try {
- engineOil.remaining = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("temperature", function () {
- return engineOil.temperature;
- });
+ VehicleCommonDataType.call(this, propertyTypes);
- this.__defineSetter__("temperature", function (val) {
- try {
- engineOil.temperature = t.long(val);
- } catch (err) {
- }
- });
+ horn.status = propertyTypes.status || false;
- this.__defineGetter__("pressure", function () {
- return engineOil.pressure;
+ this.__defineGetter__("status", function () {
+ return horn.status;
});
- this.__defineSetter__("pressure", function (val) {
+ this.__defineSetter__("status", function (val) {
try {
- engineOil.pressure = t.unsigned_short(val);
+ horn.status = t.boolean(val);
} catch (err) {
}
});
Location = function (propertyTypes) {
var location = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
location.latitude = propertyTypes.latitude || 0;
location.longitude = propertyTypes.longitude || 0;
ExteriorBrightness = function (propertyTypes) {
var eb = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
eb.exteriorBrightness = propertyTypes.exteriorBrightness || 0;
});
};
-Temperature = function (propertyTypes) {
- var temperature = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- temperature.interior = propertyTypes.interior || 0;
- temperature.exterior = propertyTypes.exterior || 0;
+RainSensor = function (propertyTypes) {
+ var rainSensor = {};
- this.__defineGetter__("interior", function () {
- return temperature.interior;
- });
+ VehicleCommonDataType.call(this, propertyTypes);
- this.__defineSetter__("interior", function (val) {
- try {
- temperature.interior = t.short(val);
- } catch (err) {
- }
- });
+ rainSensor.rain = propertyTypes.rain || 0;
+ rainSensor.zone = propertyTypes.zone || null;
- this.__defineGetter__("exterior", function () {
- return temperature.exterior;
+ this.__defineGetter__("rain", function () {
+ return rainSensor.rain;
});
- this.__defineSetter__("exterior", function (val) {
+ this.__defineSetter__("rain", function (val) {
try {
- temperature.exterior = t.short(val);
+ val = t.byte(val);
+ if (val >= 0 && val <= 10) {
+ rainSensor.rain = val;
+ }
} catch (err) {
}
});
-};
-
-RainSensor = function (propertyTypes) {
- var rainSensor = {};
- VehiclePropertyType.call(this, propertyTypes);
-
- rainSensor.rainSensor = propertyTypes.rainSensor || 0;
-
- this.__defineGetter__("rainSensor", function () {
- return rainSensor.rainSensor;
+ this.__defineGetter__("zone", function () {
+ return rainSensor.zone;
});
- this.__defineSetter__("rainSensor", function (val) {
+ this.__defineSetter__("zone", function (val) {
try {
- val = t.unsigned_short(val);
- if (val >= 0 && val <= 10) {
- rainSensor.rainSensor = val;
- }
+ rainSensor.zone = t.unsigned_short(val, "?");
} catch (err) {
}
});
WindshieldWiper = function (propertyTypes) {
var windshieldWiper = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
windshieldWiper.windshieldWiper = propertyTypes.windshieldWiper || 0;
});
};
-HVAC = function (propertyTypes) {
- var hvac = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- hvac.airflowDirection = propertyTypes.airflowDirection || 0;
- hvac.fanSpeed = propertyTypes.fanSpeed || 0;
- hvac.targetTemperature = propertyTypes.targetTemperature || 0;
- hvac.airConditioning = propertyTypes.airConditioning || false;
- hvac.airRecirculation = propertyTypes.airRecirculation || false;
- hvac.heater = propertyTypes.heater || false;
- hvac.steeringWheelHeater = propertyTypes.steeringWheelHeater || false;
- hvac.seatHeater = propertyTypes.seatHeater || false;
- hvac.seatCooler = propertyTypes.seatCooler || false;
-
- this.__defineGetter__("AIRFLOWDIRECTION_FRONTPANEL", function () {
- return 0;
- });
-
- this.__defineGetter__("AIRFLOWDIRECTION_FLOORDUCT", function () {
- return 1;
- });
-
- this.__defineGetter__("AIRFLOWDIRECTION_FRONT", function () {
- return 0x02;
- });
-
- this.__defineGetter__("AIRFLOWDIRECTION_DEFROSTER", function () {
- return 0x04;
- });
-
- this.__defineGetter__("airflowDirection", function () {
- return hvac.airflowDirection;
- });
-
- this.__defineSetter__("airflowDirection", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val === 0 || val === 1 || val === 0x02 || val === 0x04) {
- hvac.airflowDirection = val;
- }
- } catch (err) {
- }
- });
-
- this.__defineGetter__("fanSpeed", function () {
- return hvac.fanSpeed;
- });
-
- this.__defineSetter__("fanSpeed", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val >= 0 && val <= 7) {
- hvac.fanSpeed = val;
- }
- } catch (err) {
- }
- });
-
- this.__defineGetter__("targetTemperature", function () {
- return hvac.targetTemperature;
- });
-
- this.__defineSetter__("targetTemperature", function (val) {
- try {
- hvac.targetTemperature = t.unsigned_short(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("airConditioning", function () {
- return hvac.airConditioning;
- });
-
- this.__defineSetter__("airConditioning", function (val) {
- try {
- hvac.airConditioning = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("airRecirculation", function () {
- return hvac.airRecirculation;
- });
-
- this.__defineSetter__("airRecirculation", function (val) {
- try {
- hvac.airRecirculation = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("heater", function () {
- return hvac.heater;
- });
-
- this.__defineSetter__("heater", function (val) {
- try {
- hvac.heater = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("steeringWheelHeater", function () {
- return hvac.steeringWheelHeater;
- });
-
- this.__defineSetter__("steeringWheelHeater", function (val) {
- try {
- hvac.steeringWheelHeater = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("seatHeater", function () {
- return hvac.seatHeater;
- });
-
- this.__defineSetter__("seatHeater", function (val) {
- try {
- hvac.seatHeater = t.boolean(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("seatCooler", function () {
- return hvac.seatCooler;
- });
-
- this.__defineSetter__("seatCooler", function (val) {
- try {
- hvac.seatCooler = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
WindowStatus = function (propertyTypes) {
var windowStatus = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
windowStatus.openness = propertyTypes.openness || 0;
windowStatus.defrost = propertyTypes.defrost || false;
Sunroof = function (propertyTypes) {
var sunroof = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
sunroof.openness = propertyTypes.openness || 0;
sunroof.tilt = propertyTypes.tilt || 0;
+ sunroof.zone = propertyTypes.zone || null;
this.__defineGetter__("openness", function () {
return sunroof.openness;
this.__defineSetter__("openness", function (val) {
try {
- sunroof.openness = t.unsigned_short(val);
+ val = t.byte(val);
+ if (val >= 0 && val <= 100) {
+ sunroof.openness = val;
+ }
} catch (err) {
}
});
this.__defineSetter__("tilt", function (val) {
try {
- sunroof.tilt = t.unsigned_short(val);
- } catch (err) {
- }
- });
-};
-
-ConvertibleRoof = function (propertyTypes) {
- var convertibleRoof = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- convertibleRoof.openness = propertyTypes.openness || 0;
-
- this.__defineGetter__("openness", function () {
- return convertibleRoof.openness;
- });
-
- this.__defineSetter__("openness", function (val) {
- try {
- convertibleRoof.openness = t.unsigned_short(val);
- } catch (err) {
- }
- });
-};
-
-VehicleId = function (propertyTypes) {
- var vehicleId = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- vehicleId.WMI = propertyTypes.WMI || "";
- vehicleId.VIN = propertyTypes.VIN || "";
-
- this.__defineGetter__("WMI", function () {
- return vehicleId.WMI;
- });
-
- this.__defineSetter__("WMI", function (val) {
- try {
- //?
- vehicleId.WMI = t.DOMString(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("VIN", function () {
- return vehicleId.VIN;
- });
-
- this.__defineSetter__("VIN", function (val) {
- try {
- //?
- vehicleId.VIN = t.DOMString(val);
- } catch (err) {
- }
- });
-};
-
-Size = function (propertyTypes) {
- var size = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- size.width = propertyTypes.width || 0;
- size.height = propertyTypes.height || 0;
- size.length = propertyTypes.length || 0;
-
- this.__defineGetter__("width", function () {
- return size.width;
- });
-
- this.__defineSetter__("width", function (val) {
- try {
- size.width = t.unsigned_long(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("height", function () {
- return size.height;
- });
-
- this.__defineSetter__("height", function (val) {
- try {
- size.height = t.unsigned_long(val);
+ val = t.byte(val);
+ if (val >= 0 && val <= 100) {
+ sunroof.tilt = val;
+ }
} catch (err) {
}
});
- this.__defineGetter__("length", function () {
- return size.length;
+ this.__defineGetter__("zone", function () {
+ return sunroof.zone;
});
- this.__defineSetter__("length", function (val) {
+ this.__defineSetter__("zone", function (val) {
try {
- size.length = t.unsigned_long(val);
+ sunroof.zone = t.unsigned_short(val, "?");
} catch (err) {
}
});
};
-FuelInfo = function (propertyTypes) {
- var fuelInfo = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- fuelInfo.type = propertyTypes.type || 0;
- fuelInfo.refuelPosition = propertyTypes.refuelPosition || 0;
-
- this.__defineGetter__("FUELTYPE_GASOLINE", function () {
- return 0;
- });
-
- this.__defineGetter__("FUELTYPE_HIGH_OCTANE", function () {
- return 1;
- });
-
- this.__defineGetter__("FUELTYPE_DIESEL", function () {
- return 2;
- });
-
- this.__defineGetter__("FUELTYPE_ELECTRIC", function () {
- return 3;
- });
-
- this.__defineGetter__("FUELTYPE_HYDROGEN", function () {
- return 4;
- });
-
- this.__defineGetter__("REFUELPOSITION_LEFT", function () {
- return 0;
- });
-
- this.__defineGetter__("REFUELPOSITION_RIGHT", function () {
- return 1;
- });
-
- this.__defineGetter__("REFUELPOSITION_FRONT", function () {
- return 2;
- });
-
- this.__defineGetter__("REFUELPOSITION_REAR", function () {
- return 3;
- });
+ConvertibleRoof = function (propertyTypes) {
+ var convertibleRoof = {};
- this.__defineGetter__("type", function () {
- return fuelInfo.type;
- });
+ VehicleCommonDataType.call(this, propertyTypes);
- this.__defineSetter__("type", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val >= 0 && val <= 4) {
- fuelInfo.type = val;
- }
- } catch (err) {
- }
- });
+ convertibleRoof.status = propertyTypes.status || "closed";
- this.__defineGetter__("refuelPosition", function () {
- return fuelInfo.refuelPosition;
+ this.__defineGetter__("status", function () {
+ return convertibleRoof.status;
});
- this.__defineSetter__("refuelPosition", function (val) {
+ this.__defineSetter__("status", function (val) {
try {
- val = t.unsigned_short(val);
- if (val >= 0 && val <= 3) {
- fuelInfo.refuelPosition = val;
- }
+ convertibleRoof.status = t.ConvertibleRoofStatus(val);
} catch (err) {
}
});
VehicleType = function (propertyTypes) {
var vehicleType = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
vehicleType.type = propertyTypes.type || 0;
Doors = function (propertyTypes) {
var doors = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
doors.doorsPerRow = propertyTypes.doorsPerRow || [];
});
};
-TransmissionGearType = function (propertyTypes) {
- var trans = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- trans.transmissionGearType = propertyTypes.transmissionGearType || 0;
-
- this.__defineGetter__("TRANSMISSIONGEARTYPE_AUTO", function () {
- return 0;
- });
-
- this.__defineGetter__("TRANSMISSIONGEARTYPE_MANUAL", function () {
- return 1;
- });
-
- this.__defineGetter__("TRANSMISSIONGEARTYPE_CV", function () {
- return 2;
- });
-
- this.__defineGetter__("transmissionGearType", function () {
- return trans.transmissionGearType;
- });
-
- this.__defineSetter__("transmissionGearType", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val >= 0 && val <= 2) {
- trans.transmissionGearType = val;
- }
- } catch (err) {
- }
- });
-};
-
WheelInformation = function (propertyTypes) {
var wheelInfo = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
wheelInfo.frontWheelRadius = propertyTypes.frontWheelRadius || 0;
wheelInfo.rearWheelRadius = propertyTypes.rearWheelRadius || 0;
});
};
-Odometer = function (propertyTypes) {
- var odm = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- odm.odometer = propertyTypes.odometer || 0;
-
- this.__defineGetter__("odometer", function () {
- return odm.odometer;
- });
-
- this.__defineSetter__("odometer", function (val) {
- try {
- odm.odometer = t.unsigned_long(val);
- } catch (err) {
- }
- });
-};
-
Fluid = function (propertyTypes) {
var fluid = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
fluid.transmission = propertyTypes.transmission || 0;
fluid.brake = propertyTypes.brake || 0;
});
};
-Battery = function (propertyTypes) {
- var battery = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- battery.voltage = propertyTypes.voltage || 0;
- battery.current = propertyTypes.current || 0;
-
- this.__defineGetter__("voltage", function () {
- return battery.voltage;
- });
-
- this.__defineSetter__("voltage", function (val) {
- try {
- battery.voltage = t.double(val);
- } catch (err) {
- }
- });
-
- this.__defineGetter__("current", function () {
- return battery.current;
- });
-
- this.__defineSetter__("current", function (val) {
- try {
- battery.current = t.double(val);
- } catch (err) {
- }
- });
-};
-
TirePressure = function (propertyTypes) {
var tirePressure = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
tirePressure.leftFront = propertyTypes.leftFront || 0;
tirePressure.rightFront = propertyTypes.rightFront || 0;
TireTemperature = function (propertyTypes) {
var tireTemperature = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
tireTemperature.leftFront = propertyTypes.leftFront || 0;
tireTemperature.rightFront = propertyTypes.rightFront || 0;
SecurityAlert = function (propertyTypes) {
var securityAlert = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
securityAlert.securityAlert = propertyTypes.securityAlert || false;
});
};
-ParkingBrake = function (propertyTypes) {
- var parkingBrake = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- parkingBrake.parkingBrake = propertyTypes.parkingBrake || false;
-
- this.__defineGetter__("parkingBrake", function () {
- return parkingBrake.parkingBrake;
- });
-
- this.__defineSetter__("parkingBrake", function (val) {
- try {
- parkingBrake.parkingBrake = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
ParkingLight = function (propertyTypes) {
var parkingLight = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
parkingLight.parkingLight = propertyTypes.parkingLight || false;
HazardLight = function (propertyTypes) {
var hazardLight = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
hazardLight.hazardLight = propertyTypes.hazardLight || false;
});
};
-AntilockBrakingSystem = function (propertyTypes) {
- var abs = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- abs.antilockBrakingSystem = propertyTypes.antilockBrakingSystem || false;
-
- this.__defineGetter__("antilockBrakingSystem", function () {
- return abs.antilockBrakingSystem;
- });
-
- this.__defineSetter__("antilockBrakingSystem", function (val) {
- try {
- abs.antilockBrakingSystem = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
-TractionControlSystem = function (propertyTypes) {
- var tcs = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- tcs.tractionControlSystem = propertyTypes.tractionControlSystem || false;
-
- this.__defineGetter__("tractionControlSystem", function () {
- return tcs.tractionControlSystem;
- });
-
- this.__defineSetter__("tractionControlSystem", function (val) {
- try {
- tcs.tractionControlSystem = t.boolean(val);
- } catch (err) {
- }
- });
-};
-
VehicleTopSpeedLimit = function (propertyTypes) {
var vtl = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
vtl.vehicleTopSpeedLimit = propertyTypes.vehicleTopSpeedLimit || false;
});
};
-AirbagStatus = function (propertyTypes) {
- var airbagStatus = {};
-
- VehiclePropertyType.call(this, propertyTypes);
-
- airbagStatus.airbagStatus = propertyTypes.airbagStatus || 0;
-
- this.__defineGetter__("AIRBAGSTATUS_INACTIVE", function () {
- return 0;
- });
-
- this.__defineGetter__("AIRBAGSTATUS_ACTIVE", function () {
- return 1;
- });
-
- this.__defineGetter__("AIRBAGSTATUS_DEPLOYED", function () {
- return 2;
- });
-
- this.__defineGetter__("airbagStatus", function () {
- return airbagStatus.airbagStatus;
- });
-
- this.__defineSetter__("airbagStatus", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val === 0 || val === 1 || val === 2) {
- airbagStatus.airbagStatus = val;
- }
- } catch (err) {
- }
- });
-};
-
DoorStatus = function (propertyTypes) {
var doorStatus = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
doorStatus.doorStatus = propertyTypes.doorStatus || 0;
doorStatus.doorLockStatus = propertyTypes.doorLockStatus || false;
SeatBeltStatus = function (propertyTypes) {
var seatBeltStatus = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
seatBeltStatus.seatBeltStatus = propertyTypes.seatBeltStatus || false;
OccupantStatus = function (propertyTypes) {
var occupantStatus = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
occupantStatus.occupantStatus = propertyTypes.occupantStatus || 0;
ObstacleDistance = function (propertyTypes) {
var obstacleDistance = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
obstacleDistance.obstacleDistance = propertyTypes.obstacleDistance || 0;
});
};
-NightMode = function (propertyTypes) {
- var nightMode = {};
+TurnSignal = function (propertyTypes) {
+ var turnSignal = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
- nightMode.nightMode = propertyTypes.nightMode || false;
+ turnSignal.turnSignal = propertyTypes.turnSignal || 0;
- this.__defineGetter__("nightMode", function () {
- return nightMode.nightMode;
+ this.__defineGetter__("turnSignal", function () {
+ return turnSignal.turnSignal;
});
- this.__defineSetter__("nightMode", function (val) {
+ this.__defineSetter__("turnSignal", function (val) {
try {
- nightMode.nightMode = t.boolean(val);
+ turnSignal.turnSignal = t.unsigned_short(val);
} catch (err) {
}
});
};
-DrivingMode = function (propertyTypes) {
- var drivingMode = {};
+Identification = function (propertyTypes) {
+ var identification = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
- drivingMode.drivingMode = propertyTypes.drivingMode || 0;
+ identification.VIN = propertyTypes.VIN || null;
+ identification.WMI = propertyTypes.WMI || null;
+ identification.brand = propertyTypes.brand || null;
+ identification.model = propertyTypes.model || null;
+ identification.year = propertyTypes.year || null;
+ identification.vehicleType = propertyTypes.vehicleType || null;
- this.__defineGetter__("drivingMode", function () {
- return drivingMode.drivingMode;
+ this.__defineGetter__("VIN", function () {
+ return identification.VIN;
});
- this.__defineSetter__("drivingMode", function (val) {
- try {
- val = t.unsigned_short(val);
- if (val === 0 || val === 1) {
- drivingMode.drivingMode = val;
- }
- } catch (err) {
- }
+ this.__defineGetter__("WMI", function () {
+ return identification.WMI;
+ });
+
+ this.__defineGetter__("brand", function () {
+ return identification.brand;
+ });
+
+ this.__defineGetter__("model", function () {
+ return identification.model;
+ });
+
+ this.__defineGetter__("year", function () {
+ return identification.year;
+ });
+
+ this.__defineGetter__("vehicleType", function () {
+ return identification.vehicleType;
});
};
-TurnSignal = function (propertyTypes) {
- var turnSignal = {};
+SizeConfiguration = function (propertyTypes) {
+ var sizeConfiguration = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
- turnSignal.turnSignal = propertyTypes.turnSignal || 0;
+ sizeConfiguration.doorsCount = propertyTypes.doorsCount || null;
+ sizeConfiguration.height = propertyTypes.height || null;
+ sizeConfiguration.length = propertyTypes.length || null;
+ sizeConfiguration.totalDoors = propertyTypes.totalDoors || null;
+ sizeConfiguration.width = propertyTypes.width || null;
- this.__defineGetter__("turnSignal", function () {
- return turnSignal.turnSignal;
+ this.__defineGetter__("doorsCount", function () {
+ return sizeConfiguration.doorsCount;
});
- this.__defineSetter__("turnSignal", function (val) {
+ this.__defineGetter__("height", function () {
+ return sizeConfiguration.height;
+ });
+
+ this.__defineGetter__("length", function () {
+ return sizeConfiguration.length;
+ });
+
+ this.__defineGetter__("totalDoors", function () {
+ return sizeConfiguration.totalDoors;
+ });
+
+ this.__defineGetter__("width", function () {
+ return sizeConfiguration.width;
+ });
+};
+
+FuelConfiguration = function (propertyTypes) {
+ var fuelConfiguration = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ fuelConfiguration.fuelType = propertyTypes.fuelType || null;
+ fuelConfiguration.refuelPosition = propertyTypes.refuelPosition || null;
+
+ this.__defineGetter__("fuelType", function () {
+ return fuelConfiguration.fuelType;
+ });
+
+ this.__defineGetter__("refuelPosition", function () {
+ return fuelConfiguration.refuelPosition;
+ });
+};
+
+TransmissionConfiguration = function (propertyTypes) {
+ var transmissionConfiguration = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ transmissionConfiguration.transmissionGearType =
+ propertyTypes.transmissionGearType || null;
+
+ this.__defineGetter__("transmissionGearType", function () {
+ return transmissionConfiguration.transmissionGearType;
+ });
+};
+
+WheelConfiguration = function (propertyTypes) {
+ var wheelConfiguration = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ wheelConfiguration.wheelRadius = propertyTypes.wheelRadius || null;
+ wheelConfiguration.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("wheelRadius", function () {
+ return wheelConfiguration.wheelRadius;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return wheelConfiguration.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
try {
- turnSignal.turnSignal = t.unsigned_short(val);
+ wheelConfiguration.zone = t.unsigned_short(val, "?");
} catch (err) {
}
});
};
-ButtonEvent = function (propertyTypes) {
- var buttonEvent = {};
+SteeringWheelConfiguration = function (propertyTypes) {
+ var steeringWheelConfiguration = {};
- VehiclePropertyType.call(this, propertyTypes);
+ VehicleCommonDataType.call(this, propertyTypes);
- buttonEvent.buttonEvent = propertyTypes.buttonEvent || 0;
+ steeringWheelConfiguration.steeringWheelLeft =
+ propertyTypes.steeringWheelLeft || null;
- this.__defineGetter__("buttonEvent", function () {
- return buttonEvent.buttonEvent;
+ this.__defineGetter__("steeringWheelLeft", function () {
+ return steeringWheelConfiguration.steeringWheelLeft;
});
+};
- this.__defineSetter__("buttonEvent", function (val) {
+VehicleSpeed = function (propertyTypes) {
+ var vehicleSpeed = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ vehicleSpeed.speed = propertyTypes.speed || 0;
+
+ this.__defineGetter__("speed", function () {
+ return vehicleSpeed.speed;
+ });
+};
+
+WheelSpeed = function (propertyTypes) {
+ var wheelSpeed = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ wheelSpeed.speed = propertyTypes.speed || 0;
+ wheelSpeed.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("speed", function () {
+ return wheelSpeed.speed;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return wheelSpeed.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
try {
- buttonEvent.buttonEvent = t.unsigned_short(val);
+ wheelSpeed.zone = t.unsigned_short(val, "?");
} catch (err) {
}
});
};
-_initialize();
+EngineSpeed = function (propertyTypes) {
+ var engineSpeed = {};
-module.exports = _self;
+ VehicleCommonDataType.call(this, propertyTypes);
-});
-define('ripple/platform/phonegap/1.0.0/AVCodecsAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (info, id, audioCodecs, videoCodecs) {
- return {
- info: info,
- id: id,
- audioCodecs: audioCodecs,
- videoCodecs: videoCodecs
- };
-};
+ engineSpeed.speed = propertyTypes.speed || 0;
-});
-define('ripple/platform/phonegap/1.0.0/Acceleration', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (x, y, z) {
- return {
- x: x || 0,
- y: y || 0,
- z: z || 0,
- timestamp: new Date().getTime()
- };
+ this.__defineGetter__("speed", function () {
+ return engineSpeed.speed;
+ });
};
-});
-define('ripple/platform/phonegap/1.0.0/AudioCodecAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (info, id, compFormats, encode, decode) {
- return {
- info: info,
- id: id,
- compFormats: compFormats,
- encode: encode,
- decode: decode
- };
-};
+PowerTrainTorque = function (propertyTypes) {
+ var powerTrainTorque = {};
-});
-define('ripple/platform/phonegap/1.0.0/AudioDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (type, freqRangeLow, freqRangeHigh, volumeLevel, info) {
- return {
- type: type,
- freqRangeLow: freqRangeLow,
- freqRangeHigh: freqRangeHigh,
- volumeLevel: volumeLevel,
- info: info
- };
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ powerTrainTorque.value = propertyTypes.value || 0;
+ this.__defineGetter__("value", function () {
+ return powerTrainTorque.value;
+ });
};
-});
-define('ripple/platform/phonegap/1.0.0/BrailleDeviceAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (nbCells, info) {
- return {
- nbCells: nbCells,
- info: info
- };
+AcceleratorPedalPosition = function (propertyTypes) {
+ var acceleratorPedalPosition = {};
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ acceleratorPedalPosition.value = propertyTypes.value || 0;
+
+ this.__defineGetter__("value", function () {
+ return acceleratorPedalPosition.value;
+ });
};
-});
-define('ripple/platform/phonegap/1.0.0/CPUAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (info, id, usage) {
- return {
- info: info,
- id: id,
- usage: usage
- };
+ThrottlePosition = function (propertyTypes) {
+ var throttlePosition = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ throttlePosition.value = propertyTypes.value || 0;
+
+ this.__defineGetter__("value", function () {
+ return throttlePosition.value;
+ });
};
-});
-define('ripple/platform/phonegap/1.0.0/CameraAttributes', function (require, exports, module) {
-/*
- * Copyright 2011 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = function (supportsVideo, hasFlash, sensorPixels, maxZoomFactor) {
- return {
- supportsVideo: supportsVideo,
- hasFlash: hasFlash,
- sensorPixels: sensorPixels,
- maxZoomFactor: maxZoomFactor
- };
+Diagnostic = function (propertyTypes) {
+ var diagnostic = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ diagnostic.accumulatedEngineRuntime =
+ propertyTypes.accumulatedEngineRuntime || 0;
+ diagnostic.distanceWithMILOn = propertyTypes.distanceWithMILOn || 0;
+ diagnostic.distanceSinceCodeCleared =
+ propertyTypes.distanceSinceCodeCleared || 0;
+ diagnostic.timeRunMILOn = propertyTypes.timeRunMILOn || 0;
+ diagnostic.timeTroubleCodeClear = propertyTypes.timeTroubleCodeClear || 0;
+
+ this.__defineGetter__("accumulatedEngineRuntime", function () {
+ return diagnostic.accumulatedEngineRuntime;
+ });
+ this.__defineGetter__("distanceWithMILOn", function () {
+ return diagnostic.distanceWithMILOn;
+ });
+
+ this.__defineGetter__("distanceSinceCodeCleared", function () {
+ return diagnostic.distanceSinceCodeCleared;
+ });
+
+ this.__defineGetter__("timeRunMILOn", function () {
+ return diagnostic.timeRunMILOn;
+ });
+
+ this.__defineGetter__("timeTroubleCodeClear", function () {
+ return diagnostic.timeTroubleCodeClear;
+ });
};
-});
+Transmission = function (propertyTypes) {
+ var transmission = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ transmission.gear = propertyTypes.gear || null;
+ transmission.mode = propertyTypes.mode || null;
+
+ this.__defineGetter__("gear", function () {
+ return transmission.gear;
+ });
+
+ this.__defineGetter__("mode", function () {
+ return transmission.mode;
+ });
+};
+
+CruiseControlStatus = function (propertyTypes) {
+ var cruiseControlStatus = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ cruiseControlStatus.status = propertyTypes.status || false;
+ cruiseControlStatus.speed = propertyTypes.speed || 0;
+
+ this.__defineGetter__("status", function () {
+ return cruiseControlStatus.status;
+ });
+
+ this.__defineGetter__("speed", function () {
+ return cruiseControlStatus.speed;
+ });
+};
+
+LightStatus = function (propertyTypes) {
+ var lightStatus = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ lightStatus.head = propertyTypes.head || false;
+ lightStatus.rightTurn = propertyTypes.rightTurn || false;
+ lightStatus.leftTurn = propertyTypes.leftTurn || false;
+ lightStatus.brake = propertyTypes.brake || false;
+ lightStatus.fog = propertyTypes.fog || null;
+ lightStatus.hazard = propertyTypes.hazard || false;
+ lightStatus.parking = propertyTypes.parking || false;
+ lightStatus.highBeam = propertyTypes.highBeam || false;
+ lightStatus.automaticHeadlights = propertyTypes.automaticHeadlights || null;
+ lightStatus.dynamicHighBeam = propertyTypes.dynamicHighBeam || null;
+ lightStatus.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("head", function () {
+ return lightStatus.head;
+ });
+
+ this.__defineSetter__("head", function (val) {
+ try {
+ lightStatus.head = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("rightTurn", function () {
+ return lightStatus.rightTurn;
+ });
+
+ this.__defineSetter__("rightTurn", function (val) {
+ try {
+ lightStatus.rightTurn = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("leftTurn", function () {
+ return lightStatus.leftTurn;
+ });
+
+ this.__defineSetter__("leftTurn", function (val) {
+ try {
+ lightStatus.leftTurn = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("brake", function () {
+ return lightStatus.brake;
+ });
+
+ this.__defineSetter__("brake", function (val) {
+ try {
+ lightStatus.brake = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("fog", function () {
+ return lightStatus.fog;
+ });
+
+ this.__defineSetter__("fog", function (val) {
+ try {
+ lightStatus.fog = t.boolean(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("hazard", function () {
+ return lightStatus.hazard;
+ });
+
+ this.__defineSetter__("hazard", function (val) {
+ try {
+ lightStatus.hazard = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("parking", function () {
+ return lightStatus.parking;
+ });
+
+ this.__defineSetter__("parking", function (val) {
+ try {
+ lightStatus.parking = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("highBeam", function () {
+ return lightStatus.highBeam;
+ });
+
+ this.__defineSetter__("highBeam", function (val) {
+ try {
+ lightStatus.highBeam = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("automaticHeadlights", function () {
+ return lightStatus.automaticHeadlights;
+ });
+
+ this.__defineSetter__("automaticHeadlights", function (val) {
+ try {
+ lightStatus.automaticHeadlights = t.boolean(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("dynamicHighBeam", function () {
+ return lightStatus.dynamicHighBeam;
+ });
+
+ this.__defineSetter__("dynamicHighBeam", function (val) {
+ try {
+ lightStatus.dynamicHighBeam = t.boolean(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("zone", function () {
+ return lightStatus.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ lightStatus.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+InteriorLightStatus = function (propertyTypes) {
+ var interiorLightStatus = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ interiorLightStatus.passenger = propertyTypes.passenger || false;
+ interiorLightStatus.driver = propertyTypes.driver || false;
+ interiorLightStatus.center = propertyTypes.center || false;
+
+ this.__defineGetter__("passenger", function () {
+ return interiorLightStatus.passenger;
+ });
+
+ this.__defineSetter__("passenger", function (val) {
+ try {
+ interiorLightStatus.passenger = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("driver", function () {
+ return interiorLightStatus.driver;
+ });
+
+ this.__defineSetter__("driver", function (val) {
+ try {
+ interiorLightStatus.driver = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("center", function () {
+ return interiorLightStatus.center;
+ });
+
+ this.__defineSetter__("center", function (val) {
+ try {
+ interiorLightStatus.center = t.boolean(val);
+ } catch (err) {
+ }
+ });
+};
+
+Chime = function (propertyTypes) {
+ var chime = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ chime.status = chime.status || false;
+
+ this.__defineGetter__("status", function () {
+ return chime.status;
+ });
+};
+
+Fuel = function (propertyTypes) {
+ var fuel = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ fuel.level = propertyTypes.level || 0;
+ fuel.range = propertyTypes.range || 0;
+ fuel.instantConsumption = propertyTypes.instantConsumption || 0;
+ fuel.averageConsumption = propertyTypes.averageConsumption || 0;
+ fuel.fuelConsumedSinceRestart = propertyTypes.fuelConsumedSinceRestart || 0;
+ fuel.vehicleTimeSinceRestart = propertyTypes.vehicleTimeSinceRestart || 0;
+
+ this.__defineGetter__("level", function () {
+ return fuel.level;
+ });
+
+ this.__defineGetter__("range", function () {
+ return fuel.range;
+ });
+
+ this.__defineGetter__("instantConsumption", function () {
+ return fuel.instantConsumption;
+ });
+
+ this.__defineGetter__("averageConsumption", function () {
+ return fuel.averageConsumption;
+ });
+
+ this.__defineGetter__("fuelConsumedSinceRestart", function () {
+ return fuel.fuelConsumedSinceRestart;
+ });
+
+ this.__defineGetter__("vehicleTimeSinceRestart", function () {
+ return fuel.vehicleTimeSinceRestart;
+ });
+};
+
+EngineOil = function (propertyTypes) {
+ var engineOil = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ engineOil.remaining = propertyTypes.remaining || 0;
+ engineOil.temperature = propertyTypes.temperature || 0;
+ engineOil.pressure = propertyTypes.Pressure || 0;
+
+ this.__defineGetter__("remaining", function () {
+ return engineOil.remaining;
+ });
+
+ this.__defineSetter__("remaining", function (val) {
+ try {
+ engineOil.remaining = t.unsigned_short(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("temperature", function () {
+ return engineOil.temperature;
+ });
+
+ this.__defineSetter__("temperature", function (val) {
+ try {
+ engineOil.temperature = t.long(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("pressure", function () {
+ return engineOil.pressure;
+ });
+
+ this.__defineSetter__("pressure", function (val) {
+ try {
+ engineOil.pressure = t.unsigned_short(val);
+ } catch (err) {
+ }
+ });
+};
+
+Acceleration = function (propertyTypes) {
+ var acceleration = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ acceleration.x = propertyTypes.x || 0;
+ acceleration.y = propertyTypes.y || 0;
+ acceleration.z = propertyTypes.z || 0;
+
+ this.__defineGetter__("x", function () {
+ return acceleration.x;
+ });
+
+ this.__defineGetter__("y", function () {
+ return acceleration.y;
+ });
+
+ this.__defineGetter__("z", function () {
+ return acceleration.z;
+ });
+};
+
+EngineCoolant = function (propertyTypes) {
+ var engineCoolant = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ engineCoolant.level = propertyTypes.level || 0;
+ engineCoolant.temperature = propertyTypes.temperature || 0;
+
+ this.__defineGetter__("level", function () {
+ return engineCoolant.level;
+ });
+
+ this.__defineGetter__("temperature", function () {
+ return engineCoolant.temperature;
+ });
+};
+
+SteeringWheel = function (propertyTypes) {
+ var steeringWheel = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ steeringWheel.angle = propertyTypes.angle || 0;
+
+ this.__defineGetter__("angle", function () {
+ return steeringWheel.angle;
+ });
+};
+
+IgnitionTime = function (propertyTypes) {
+ var ignitionTime = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ ignitionTime.ignitionOnTime = propertyTypes.ignitionOnTime || 0;
+ ignitionTime.ignitionOffTime = propertyTypes.ignitionOffTime || 0;
+
+ this.__defineGetter__("ignitionOnTime", function () {
+ return ignitionTime.ignitionOnTime;
+ });
+
+ this.__defineGetter__("ignitionOffTime", function () {
+ return ignitionTime.ignitionOffTime;
+ });
+};
+
+YawRate = function (propertyTypes) {
+ var yawRate = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ yawRate.value = propertyTypes.value || 0;
+
+ this.__defineGetter__("value", function () {
+ return yawRate.value;
+ });
+};
+
+BrakeOperation = function (propertyTypes) {
+ var brakeOperation = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ brakeOperation.brakePedalDepressed = propertyTypes.brakePedalDepressed ||
+ false;
+
+ this.__defineGetter__("brakePedalDepressed", function () {
+ return brakeOperation.brakePedalDepressed;
+ });
+};
+
+WheelTick = function (propertyTypes) {
+ var wheelTick = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ wheelTick.value = propertyTypes.value || 0;
+ wheelTick.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("value", function () {
+ return wheelTick.value;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return wheelTick.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ wheelTick.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+ButtonEvent = function (propertyTypes) {
+ var buttonEvent = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ buttonEvent.buttonEvent = propertyTypes.buttonEvent || 0;
+
+ this.__defineGetter__("buttonEvent", function () {
+ return buttonEvent.buttonEvent;
+ });
+
+ this.__defineSetter__("buttonEvent", function (val) {
+ try {
+ buttonEvent.buttonEvent = t.unsigned_short(val);
+ } catch (err) {
+ }
+ });
+};
+
+DrivingMode = function (propertyTypes) {
+ var drivingMode = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ drivingMode.mode = propertyTypes.mode || false;
+
+ this.__defineGetter__("drivingMode", function () {
+ return drivingMode.drivingMode;
+ });
+};
+
+NightMode = function (propertyTypes) {
+ var nightMode = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ nightMode.mode = propertyTypes.mode || false;
+
+ this.__defineGetter__("mode", function () {
+ return nightMode.mode;
+ });
+
+ this.__defineSetter__("mode", function (val) {
+ try {
+ nightMode.mode = t.boolean(val);
+ } catch (err) {
+ }
+ });
+};
+
+Odometer = function (propertyTypes) {
+ var odm = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ odm.distanceSinceStart = propertyTypes.distanceSinceStart || null;
+ odm.distanceTotal = propertyTypes.distanceTotal || 0;
+
+ this.__defineGetter__("distanceSinceStart", function () {
+ return odm.distanceSinceStart;
+ });
+
+ this.__defineGetter__("distanceTotal", function () {
+ return odm.distanceTotal;
+ });
+};
+
+BatteryStatus = function (propertyTypes) {
+ var batteryStatus = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ batteryStatus.chargeLevel = batteryStatus.chargeLevel || null;
+ batteryStatus.voltage = batteryStatus.voltage || null;
+ batteryStatus.current = batteryStatus.current || null;
+ batteryStatus.zone = batteryStatus.zone || null;
+
+ this.__defineGetter__("chargeLevel", function () {
+ return batteryStatus.chargeLevel;
+ });
+
+ this.__defineGetter__("voltage", function () {
+ return batteryStatus.voltage;
+ });
+
+ this.__defineGetter__("current", function () {
+ return batteryStatus.current;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return batteryStatus.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ batteryStatus.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+Tire = function (propertyTypes) {
+ var tire = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ tire.pressureLow = propertyTypes.pressureLow || null;
+ tire.pressure = propertyTypes.pressure || null;
+ tire.temperature = propertyTypes.temperature || null;
+ tire.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("pressureLow", function () {
+ return tire.pressureLow;
+ });
+
+ this.__defineGetter__("pressure", function () {
+ return tire.pressure;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return tire.zone;
+ });
+
+ this.__defineGetter__("temperature", function () {
+ return tire.temperature;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ tire.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+AntilockBrakingSystem = function (propertyTypes) {
+ var abs = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ abs.enabled = propertyTypes.enabled || false;
+ abs.engaged = propertyTypes.engaged || false;
+
+ this.__defineGetter__("enabled", function () {
+ return abs.enabled;
+ });
+
+ this.__defineGetter__("engaged", function () {
+ return abs.engaged;
+ });
+};
+
+TractionControlSystem = function (propertyTypes) {
+ var tcs = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ tcs.enabled = propertyTypes.enabled || false;
+ tcs.engaged = propertyTypes.engaged || false;
+
+ this.__defineGetter__("enabled", function () {
+ return tcs.enabled;
+ });
+
+ this.__defineGetter__("engaged", function () {
+ return tcs.engaged;
+ });
+};
+
+AirbagStatus = function (propertyTypes) {
+ var airbagStatus = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ airbagStatus.activated = propertyTypes.activated || false;
+ airbagStatus.deployed = propertyTypes.deployed || false;
+ airbagStatus.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("activated", function () {
+ return airbagStatus.activated;
+ });
+
+ this.__defineGetter__("deployed", function () {
+ return airbagStatus.deployed;
+ });
+
+ this.__defineGetter__("zone", function () {
+ return airbagStatus.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ airbagStatus.zone = t.unsigned_short(val);
+ } catch (err) {
+ }
+ });
+};
+
+Door = function (propertyTypes) {
+ var door = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ door.status = propertyTypes.status || "closed";
+ door.lock = propertyTypes.lock || false;
+ door.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("status", function () {
+ return door.status;
+ });
+
+ this.__defineGetter__("lock", function () {
+ return door.lock;
+ });
+
+ this.__defineSetter__("lock", function (val) {
+ try {
+ door.lock = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("zone", function () {
+ return door.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ door.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+Temperature = function (propertyTypes) {
+ var temperature = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ temperature.interiorTemperature = propertyTypes.interiorTemperature || 0;
+ temperature.exteriorTemperature = propertyTypes.exteriorTemperature || 0;
+
+ this.__defineGetter__("interiorTemperature", function () {
+ return temperature.interiorTemperature;
+ });
+
+ this.__defineGetter__("exteriorTemperature", function () {
+ return temperature.exteriorTemperature;
+ });
+};
+
+Defrost = function (propertyTypes) {
+ var defrost = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ defrost.defrostWindow = propertyTypes.defrostWindow || null;
+ defrost.defrostMirrors = propertyTypes.defrostMirrors || null;
+ defrost.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("defrostWindow", function () {
+ return defrost.defrostWindow;
+ });
+
+ this.__defineSetter__("defrostWindow", function (val) {
+ try {
+ defrost.defrostWindow = t.boolean(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("defrostMirrors", function () {
+ return defrost.defrostMirrors;
+ });
+
+ this.__defineSetter__("defrostMirrors", function (val) {
+ try {
+ defrost.defrostMirrors = t.boolean(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("zone", function () {
+ return defrost.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ defrost.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+ClimateControl = function (propertyTypes) {
+ var climateControl = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ climateControl.airflowDirection = propertyTypes.airflowDirection ||
+ "frontpanel";
+ climateControl.fanSpeedLevel = propertyTypes.fanSpeedLevel || 0;
+ climateControl.targetTemperature = propertyTypes.targetTemperature || null;
+ climateControl.airConditioning = propertyTypes.airConditioning || false;
+ climateControl.heater = propertyTypes.heater || false;
+ climateControl.seatHeater = propertyTypes.seatHeater || null;
+ climateControl.seatCooler = propertyTypes.seatCooler || null;
+ climateControl.airRecirculation = propertyTypes.airRecirculation || false;
+ climateControl.steeringWheelHeater = propertyTypes.steeringWheelHeater ||
+ null;
+ climateControl.zone = propertyTypes.zone || null;
+
+ this.__defineGetter__("airflowDirection", function () {
+ return climateControl.airflowDirection;
+ });
+
+ this.__defineSetter__("airflowDirection", function (val) {
+ try {
+ climateControl.airflowDirection = t.AirflowDirection(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("fanSpeedLevel", function () {
+ return climateControl.fanSpeedLevel;
+ });
+
+ this.__defineSetter__("fanSpeedLevel", function (val) {
+ try {
+ climateControl.fanSpeedLevel = t.byte(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("targetTemperature", function () {
+ return climateControl.targetTemperature;
+ });
+
+ this.__defineSetter__("targetTemperature", function (val) {
+ try {
+ climateControl.targetTemperature = t.byte(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("airConditioning", function () {
+ return climateControl.airConditioning;
+ });
+
+ this.__defineSetter__("airConditioning", function (val) {
+ try {
+ climateControl.airConditioning = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("heater", function () {
+ return climateControl.heater;
+ });
+
+ this.__defineSetter__("heater", function (val) {
+ try {
+ climateControl.heater = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("seatHeater", function () {
+ return climateControl.seatHeater;
+ });
+
+ this.__defineSetter__("seatHeater", function (val) {
+ try {
+ climateControl.seatHeater = t.byte(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("seatCooler", function () {
+ return climateControl.seatCooler;
+ });
+
+ this.__defineSetter__("seatCooler", function (val) {
+ try {
+ climateControl.seatCooler = t.byte(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("airRecirculation", function () {
+ return climateControl.airRecirculation;
+ });
+
+ this.__defineSetter__("airRecirculation", function (val) {
+ try {
+ climateControl.airRecirculation = t.boolean(val);
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("steeringWheelHeater", function () {
+ return climateControl.steeringWheelHeater;
+ });
+
+ this.__defineSetter__("steeringWheelHeater", function (val) {
+ try {
+ climateControl.steeringWheelHeater = t.byte(val, "?");
+ } catch (err) {
+ }
+ });
+
+ this.__defineGetter__("zone", function () {
+ return climateControl.zone;
+ });
+
+ this.__defineSetter__("zone", function (val) {
+ try {
+ climateControl.zone = t.unsigned_short(val, "?");
+ } catch (err) {
+ }
+ });
+};
+
+ParkingBrake = function (propertyTypes) {
+ var parkingBrake = {};
+
+ VehicleCommonDataType.call(this, propertyTypes);
+
+ parkingBrake.status = propertyTypes.status || "inactive";
+
+ this.__defineGetter__("status", function () {
+ return parkingBrake.status;
+ });
+
+ this.__defineSetter__("status", function (val) {
+ try {
+ parkingBrake.status = t.ParkingBrakeStatus(val);
+ } catch (err) {
+ }
+ });
+};
+
+_initialize();
+
+module.exports = _self;
+
+});
+define('ripple/platform/phonegap/1.0.0/AVCodecsAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (info, id, audioCodecs, videoCodecs) {
+ return {
+ info: info,
+ id: id,
+ audioCodecs: audioCodecs,
+ videoCodecs: videoCodecs
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/Acceleration', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (x, y, z) {
+ return {
+ x: x || 0,
+ y: y || 0,
+ z: z || 0,
+ timestamp: new Date().getTime()
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/AudioCodecAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (info, id, compFormats, encode, decode) {
+ return {
+ info: info,
+ id: id,
+ compFormats: compFormats,
+ encode: encode,
+ decode: decode
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/AudioDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (type, freqRangeLow, freqRangeHigh, volumeLevel, info) {
+ return {
+ type: type,
+ freqRangeLow: freqRangeLow,
+ freqRangeHigh: freqRangeHigh,
+ volumeLevel: volumeLevel,
+ info: info
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/BrailleDeviceAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (nbCells, info) {
+ return {
+ nbCells: nbCells,
+ info: info
+ };
+
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/CPUAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (info, id, usage) {
+ return {
+ info: info,
+ id: id,
+ usage: usage
+ };
+};
+
+});
+define('ripple/platform/phonegap/1.0.0/CameraAttributes', function (require, exports, module) {
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = function (supportsVideo, hasFlash, sensorPixels, maxZoomFactor) {
+ return {
+ supportsVideo: supportsVideo,
+ hasFlash: hasFlash,
+ sensorPixels: sensorPixels,
+ maxZoomFactor: maxZoomFactor
+ };
+
+};
+
+});
define('ripple/platform/phonegap/1.0.0/Connection', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
//"phonegap": {"1.0.0": require('ripple/platform/phonegap/1.0.0/spec')},
"tizen": {"2.0": require('ripple/platform/tizen/2.0/spec')},
"ivi": {"3.0": require('ripple/platform/ivi/3.0/spec')},
+ "wearable": {"2.0": require('ripple/platform/wearable/2.0/spec')},
//"cordova": {"2.0.0": require('ripple/platform/cordova/2.0.0/spec')},
//"webworks.bb10": {"1.0.0": require('ripple/platform/webworks.bb10/1.0.0/spec')},
//"webworks.handset": {"2.0.0": require('ripple/platform/webworks.handset/2.0.0/spec')},
}
firstCallWatchObj = window.setTimeout(function () {
- _getValue(property, successCallback, null);
+ if (property !== "BATTERY") {
+ _getValue(property, successCallback, null);
+ }
delete _firstCall_watches[watchId];
}, 1);
feature: "http://wacapps.net/api/deviceinteraction"
}
}
- }
+ }
+ }
+};
+
+
+});
+define('ripple/platform/wac/2.0/task', function (require, exports, module) {
+/*
+ * Copyright 2011 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var db = require('ripple/db'),
+ utils = require('ripple/utils'),
+ _console = require('ripple/console'),
+ exception = require('ripple/exception'),
+ errorcode = require('ripple/platform/wac/2.0/errorcode'),
+ wac2_utils = require('ripple/platform/wac/2.0/wac2_utils'),
+ PendingObject = require('ripple/platform/wac/2.0/pendingObject'),
+ DeviceApiError = require('ripple/platform/wac/2.0/deviceapierror'),
+ PendingOperation = require('ripple/platform/wac/2.0/pendingoperation'),
+ Task, TaskList, _get,
+ _ID_WITHOUT = 0, _ID_GEN_NEW = 1, _ID_FROM_PROP = 2,
+ _SIM_TASK_LIST = 0, _DEVICE_TASK_LIST = 1,
+ _HIGH_PRIORITY = 0, _MEDIUM_PRIORITY = 1, _LOW_PRIORITY = 2,
+ _STATUS_COMPLETED = 0, _STATUS_NEEDS_ACTION = 1, _STATUS_IN_PROCESS = 2, _STATUS_CANCELLED = 3,
+ _TASK_OBJECTS = "wac2.0-pim-task-objects",
+ _addTaskAllowed = true, _deleteTaskAllowed = true,
+ _updateTaskAllowed = true, _findTasksAllowed = true;
+
+
+module.exports = function () {
+ var _taskListArray = [],
+ _PENDING_TIME = 10;
+
+ function _pendingOperate(operate) {
+ var pendingObj, pendingOperation, i, argumentVector = [];
+
+ for (i = 0; i < arguments.length - 1; i++)
+ argumentVector[i] = arguments[i + 1];
+
+ pendingObj = new PendingObject();
+
+ pendingObj.pendingID = window.setTimeout(function () {
+ pendingObj.setCancelFlag(false);
+ operate.apply(this, argumentVector);
+ }, _PENDING_TIME);
+
+ pendingOperation = new PendingOperation(pendingObj);
+
+ return pendingOperation;
+ }
+
+ /* taskProperties attribute check & paste */
+ function _checkAndPasteProperties(p, dst) {
+
+ if (p.summary !== null && p.summary !== undefined)
+ dst.summary = String(p.summary);
+
+ if (p.description !== null && p.description !== undefined)
+ dst.description = String(p.description);
+
+ if (p.status !== null && p.status !== undefined) {
+ if (p.status === _STATUS_COMPLETED ||
+ p.status === _STATUS_NEEDS_ACTION ||
+ p.status === _STATUS_IN_PROCESS ||
+ p.status === _STATUS_CANCELLED) {
+ dst.status = p.status;
+ } else
+ return false;
+ }
+
+ if (p.priority !== null && p.priority !== undefined) {
+ if (p.priority === _HIGH_PRIORITY ||
+ p.priority === _MEDIUM_PRIORITY ||
+ p.priority === _LOW_PRIORITY) {
+ dst.priority = p.priority;
+ } else
+ return false;
+ }
+
+ if (p.dueDate !== null && p.dueDate !== undefined) {
+ if (!wac2_utils.isValidDate(p.dueDate))
+ return false;
+ dst.dueDate = new Date(p.dueDate);
+ }
+
+ /* dueDate is a option properties.
+ "The default value is undefined.
+ If no value is provided, the task has no due date."
+ If p.dueDate is set its default value 'undefined',
+ we assign default value to dst.dueDate */
+ if (p.dueDate === undefined) {
+ dst.dueDate = undefined;
+ }
+
+ return true;
+ }
+
+ function _taskFilterCheck(filter) {
+ var i;
+ if (filter.id !== undefined && filter.id !== null) {
+ filter.id = String(filter.id);
+ } else {
+ filter.id = undefined;
+ }
+ if (filter.summary !== undefined && filter.summary !== null) {
+ filter.summary = String(filter.summary);
+ } else {
+ filter.summary = undefined;
+ }
+ if (filter.description !== undefined && filter.description !== null) {
+ filter.description = String(filter.description);
+ } else {
+ filter.description = undefined;
+ }
+ if (filter.status !== undefined && filter.status !== null) {
+ if (!wac2_utils.isValidArray(filter.status)) {
+ return false;
+ }
+ for (i = 0; i < filter.status.length; i++) {
+ filter.status[i] = filter.status[i] | 0;
+ if (filter.status[i] !== _STATUS_COMPLETED &&
+ filter.status[i] !== _STATUS_NEEDS_ACTION &&
+ filter.status[i] !== _STATUS_IN_PROCESS &&
+ filter.status[i] !== _STATUS_CANCELLED) {
+ return false;
+ }
+ }
+ } else {
+ filter.status = undefined;
+ }
+ if (filter.priority !== undefined && filter.priority !== null) {
+ if (!wac2_utils.isValidArray(filter.priority)) {
+ return false;
+ }
+ for (i = 0; i < filter.priority.length; i++) {
+ filter.priority[i] = filter.priority[i] | 0;
+ if (filter.priority[i] !== _HIGH_PRIORITY &&
+ filter.priority[i] !== _MEDIUM_PRIORITY &&
+ filter.priority[i] !== _LOW_PRIORITY) {
+ return false;
+ }
+ }
+ } else {
+ filter.priority = undefined;
+ }
+ if (filter.dueDate !== undefined && filter.dueDate !== null) {
+ if (!wac2_utils.isValidDate(filter.dueDate)) {
+ return false;
+ }
+ filter.dueDate = new Date(filter.dueDate);
+ } else {
+ filter.dueDate = undefined;
+ }
+ return true;
+ }
+
+ function TaskProperties(prop) {
+ var _self;
+ _self = {
+ priority : _LOW_PRIORITY,
+ description : "",
+ summary : "",
+ dueDate : undefined,
+ status : _STATUS_NEEDS_ACTION
+ };
+ if (prop) {
+ if (_checkAndPasteProperties(prop, _self) === false)
+ return undefined;
+ }
+ return _self;
+ }
+
+ function Task(prop, idChoice) {
+ var id, _self = new TaskProperties(prop);
+ /* if error occurs during checking, _self is an empty object.
+ so i randomly pick description to check if property check fails */
+ if (_self.description === undefined)
+ return undefined;
+
+ switch (idChoice) {
+ case _ID_WITHOUT:
+ // do nothing
+ break;
+ case _ID_GEN_NEW:
+ id = Math.uuid(undefined, 16);
+ _self.__defineGetter__("id", function () {
+ return id;
+ });
+ break;
+ case _ID_FROM_PROP:
+ id = String(prop.id);
+ _self.__defineGetter__("id", function () {
+ return id;
+ });
+ break;
+ }
+
+ return _self;
+ }
+
+ function _get() {
+ var taskListArray = [],
+ data = db.retrieveObject(_TASK_OBJECTS);
+ utils.forEach(data, function (taskList) {
+ for (var t in taskList._list) {
+ if (taskList._list[t].dueDate !== undefined &&
+ taskList._list[t].dueDate !== null)
+ taskList._list[t].dueDate = new Date(taskList._list[t].dueDate);
+ }
+ taskListArray.push(new TaskList(taskList._list, taskList.type, taskList.name));
+ });
+
+ /* add default taskList if taskListArray is empty */
+ if (taskListArray.length === 0) {
+ taskListArray = [new TaskList({}, 0, "Office tasks"), new TaskList({}, 1, "Home tasks")];
+ }
+
+ return taskListArray;
+ }
+
+ function _save() {
+ db.saveObject(_TASK_OBJECTS, _taskListArray);
+ }
+
+ function TaskList(taskList, type, name) {
+ var task;
+ this._list = taskList;
+ this.type = type;
+ this.name = name;
+
+ this.createTask = function (properties) {
+ task = new Task(properties, _ID_WITHOUT);
+ /* if error occurs during checking, task is an empty object.
+ so i randomly pick summary to check if property check fails */
+ if (task.summary === undefined) {
+ exception.raise(exception.types.Argument,
+ "EventProperties: input parameter contains invalid values",
+ new DeviceApiError(errorcode.INVALID_VALUES_ERR));
+ return undefined;
+ }
+ return task;
+ };
+
+ this.addTask = function (onSuccess, onError, task) {
+ var inner = this,
+ newTask, _task = Object(task);
+ function _addTask() {
+ var ret;
+ if (!_addTaskAllowed) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.SECURITY_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+ newTask = new Task(_task, _ID_GEN_NEW);
+ /* if error occurs during checking, newTask is an empty object.
+ so i randomly pick id to check if property check fails */
+ if (newTask.id === undefined) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+ ret = _pendingOperate(function () {
+ inner._list[newTask.id] = newTask;
+ _save();
+ onSuccess(new Task(newTask, _ID_FROM_PROP));
+ });
+ }
+
+ return wac2_utils.validateTypeMismatch(onSuccess, onError, "addTask", _addTask);
+ };
+
+ this.updateTask = function (onSuccess, onError, task) {
+ var inner = this,
+ newTask, _task = Object(task);
+ function _updateTask() {
+ var ret;
+ if (!_updateTaskAllowed) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.SECURITY_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+
+ if (_checkAndPasteProperties(_task, _task) === false) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+
+ ret = _pendingOperate(function () {
+ if (inner._list[_task.id]) {
+ newTask = new Task(inner._list[_task.id], _ID_FROM_PROP);
+ /* Don't need to double check the return of _checkAndPasteProperties
+ _task has been checked & pasted already */
+ _checkAndPasteProperties(_task, newTask);
+ inner._list[newTask.id] = newTask;
+ _save();
+ onSuccess();
+ } else {
+ if (onError) {
+ onError(new DeviceApiError(errorcode.NOT_FOUND_ERR));
+ }
+ }
+ });
+ return ret;
+ }
+
+ return wac2_utils.validateTypeMismatch(onSuccess, onError, "updateTask", _updateTask);
+ };
+
+ this.deleteTask = function (onSuccess, onError, id) {
+ var inner = this;
+ function _deleteTask() {
+ var ret;
+ /* according to spec "If any of the input parameters are not
+ compatible with the expected type for that parameter,
+ a DeviceAPIError with code TYPE_MISMATCH_ERR MUST be
+ synchronously thrown." so an error is raised synchronously */
+ utils.validateArgumentType(id, "string", null,
+ "Task:deleteTask: " + " invalid id parameter",
+ new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
+ if (!_deleteTaskAllowed) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.SECURITY_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+ ret = _pendingOperate(function () {
+ if (inner._list[id]) {
+ delete inner._list[id];
+ _save();
+ onSuccess();
+ } else {
+ if (onError)
+ onError(new DeviceApiError(errorcode.NOT_FOUND_ERR));
+ }
+ });
+ return ret;
+ }
+
+ return wac2_utils.validateTypeMismatch(onSuccess, onError, "deleteTask", _deleteTask);
+ };
+
+ this.findTasks = function (onSuccess, onError, filter) {
+ var inner = this, _filter = Object(filter), tmp = [], rst = [], valid_tmp = false;
+ function _findTasks() {
+ var ret;
+ if (!_taskFilterCheck(_filter)) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+ if (!_findTasksAllowed) {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.SECURITY_ERR));
+ }, 1);
+ }
+ return undefined;
+ }
+ ret = _pendingOperate(function () {
+ var i, e;
+ if (_filter.id !== undefined) {
+ tmp = wac2_utils.matchOptionString(inner._list, "id", _filter.id);
+ valid_tmp = true;
+ }
+ if (_filter.summary !== undefined) {
+ if (valid_tmp) {
+ tmp = wac2_utils.matchOptionString(tmp, "summary", _filter.summary);
+ } else {
+ tmp = wac2_utils.matchOptionString(inner._list, "summary", _filter.summary);
+ valid_tmp = true;
+ }
+ }
+ if (_filter.description !== undefined) {
+ if (valid_tmp) {
+ tmp = wac2_utils.matchOptionString(tmp, "description", _filter.description);
+ } else {
+ tmp = wac2_utils.matchOptionString(inner._list, "description", _filter.description);
+ valid_tmp = true;
+ }
+ }
+ if (_filter.status !== undefined) {
+ if (valid_tmp) {
+ tmp = wac2_utils.matchOptionShortArray(tmp, "status", _filter.status);
+ } else {
+ tmp = wac2_utils.matchOptionShortArray(inner._list, "status", _filter.status);
+ valid_tmp = true;
+ }
+ }
+ if (_filter.priority !== undefined) {
+ if (valid_tmp) {
+ tmp = wac2_utils.matchOptionShortArray(tmp, "priority", _filter.priority);
+ } else {
+ tmp = wac2_utils.matchOptionShortArray(inner._list, "priority", _filter.priority);
+ valid_tmp = true;
+ }
+ }
+ if (_filter.initialDueDate !== undefined ||
+ _filter.endDueDate !== undefined) {
+ if (valid_tmp) {
+ tmp = wac2_utils.matchOptionDate(tmp, "dueDate", _filter.initialDueDate, _filter.endDueDate);
+ } else {
+ tmp = wac2_utils.matchOptionDate(inner._list, "dueDate", _filter.initialDueDate, _filter.endDueDate);
+ valid_tmp = true;
+ }
+ }
+
+ if (valid_tmp) {
+ for (i = 0; i < tmp.length; i++) {
+ rst.push(new Task(tmp[i], _ID_FROM_PROP));
+ }
+ } else {
+ for (e in inner._list) {
+ rst.push(new Task(inner._list[e], _ID_FROM_PROP));
+ }
+ }
+ onSuccess(rst);
+ });
+ return ret;
+ }
+
+ return wac2_utils.validateTypeMismatch(onSuccess, onError, "findTasks", _findTasks);
+ };
+ }
+
+ this.getTaskLists = function (onSuccess, onError) {
+ function _getTaskLists() {
+ var ret;
+ ret = _pendingOperate(function () {
+ if (_taskListArray.length === 0) {
+ _taskListArray = _get();
+ }
+ onSuccess(_taskListArray);
+ }, 1);
+ return ret;
+ }
+
+ return wac2_utils.validateTypeMismatch(onSuccess, onError, "getTaskLists", _getTaskLists);
+ };
+
+ this.__defineGetter__("SIM_TASK_LIST", function () {
+ return 0;
+ });
+ this.__defineGetter__("DEVICE_TASK_LIST", function () {
+ return 1;
+ });
+ this.__defineGetter__("HIGH_PRIORITY", function () {
+ return 0;
+ });
+ this.__defineGetter__("MEDIUM_PRIORITY", function () {
+ return 1;
+ });
+ this.__defineGetter__("LOW_PRIORITY", function () {
+ return 2;
+ });
+ this.__defineGetter__("STATUS_COMPLETED", function () {
+ return 0;
+ });
+ this.__defineGetter__("STATUS_NEEDS_ACTION", function () {
+ return 1;
+ });
+ this.__defineGetter__("STATUS_IN_PROCESS", function () {
+ return 2;
+ });
+ this.__defineGetter__("STATUS_CANCELLED", function () {
+ return 3;
+ });
+
+ this.handleSubFeatures = function (subFeatures) {
+ if (wac2_utils.isEmptyObject(subFeatures) ||
+ subFeatures["http://wacapps.net/api/pim.task"] ||
+ (subFeatures["http://wacapps.net/api/pim.task.read"] &&
+ subFeatures["http://wacapps.net/api/pim.task.write"])) {
+ return;
+ }
+ if (subFeatures["http://wacapps.net/api/pim.task.read"] &&
+ !subFeatures["http://wacapps.net/api/pim.task.write"]) {
+ _addTaskAllowed = false;
+ _deleteTaskAllowed = false;
+ _updateTaskAllowed = false;
+ return;
+ }
+ if (subFeatures["http://wacapps.net/api/pim.task.write"] &&
+ !subFeatures["http://wacapps.net/api/pim.task.read"]) {
+ _findTasksAllowed = false;
+ return;
+ }
+ _console.warn("WAC-2.0-Task-handleSubFeatures: something wrong");
+ };
+
+};
+
+
+});
+define('ripple/platform/wac/2.0/typecoerce', function (require, exports, module) {
+/*\r
+ * Copyright 2011 Intel Corporation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+var utils = require('ripple/utils'),\r
+ _self;\r
+\r
+_self = function (pattern) {\r
+ var typeCoerce,\r
+ typeOfPattern = Object.prototype.toString.call(pattern);\r
+\r
+ typeCoerce = {\r
+ cast: function (obj) {\r
+ var validObj,\r
+ validValue,\r
+ elementType,\r
+ typeOfObj = Object.prototype.toString.call(obj);\r
+\r
+ switch (typeOfPattern) {\r
+ case "[object String]":\r
+ validObj = (typeOfObj !== typeOfPattern) ? String(obj) : obj;\r
+ break;\r
+\r
+ case "[object Number]":\r
+ validObj = (typeOfObj !== typeOfPattern) ? (Number(obj) | 0) : obj;\r
+ break;\r
+\r
+ case "[object Object]":\r
+ if (typeOfObj !== typeOfPattern) {\r
+ validObj = {};\r
+ } else {\r
+ validObj = obj;\r
+ utils.forEach(validObj, function (value, key) {\r
+ if (pattern[key] === undefined) {\r
+ delete validObj[key];\r
+ } else {\r
+ validValue = _self(pattern[key]).cast(value);\r
+ if (validObj[key] !== validValue)\r
+ validObj[key] = validValue;\r
+ }\r
+ });\r
+ }\r
+ break;\r
+\r
+ case "[object Array]":\r
+ if (typeOfObj !== typeOfPattern) {\r
+ validObj = [];\r
+ } else {\r
+ validObj = obj;\r
+ elementType = _self(pattern[0]);\r
+ utils.forEach(validObj, function (element, index) {\r
+ validObj[index] = elementType.cast(element);\r
+ });\r
+ }\r
+ break;\r
+ }\r
+\r
+ return validObj;\r
+ }\r
+ };\r
+\r
+ return typeCoerce;\r
+};\r
+\r
+module.exports = _self;\r
+
+});
+define('ripple/platform/wac/2.0/wac2_utils', function (require, exports, module) {
+/*
+ * Copyright 2011 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var utils = require('ripple/utils'),
+ errorcode = require('ripple/platform/wac/2.0/errorcode'),
+ DeviceApiError = require('ripple/platform/wac/2.0/deviceapierror');
+
+module.exports = {
+ _wac2_regexSanitize: function (regexString) {
+ var escapePattern = /([^\\]|^)(%)/g, percentPattern = /\\%/g;
+ return regexString.replace("^", "\\^")
+ .replace("$", "\\$")
+ .replace("(", "\\(")
+ .replace(")", "\\)")
+ .replace("<", "\\<")
+ .replace("[", "\\[")
+ .replace("{", "\\{")
+ .replace(/\\([^%])/, "\\\\$1") /* don't replace \\% */
+ .replace("|", "\\|")
+ .replace(">", "\\>")
+ .replace(".", "\\.")
+ .replace("*", "\\*")
+ .replace("+", "\\+")
+ .replace("?", "\\?")
+ .replace(escapePattern, "$1.*") /* replace % with .* */
+ .replace(percentPattern, "%"); /* strip excape of % */
+ },
+
+ isValidDate: function (d) {
+ if (Object.prototype.toString.call(d) !== "[object Date]")
+ return false;
+ return !isNaN(d.getTime());
+ },
+
+ isValidArray: function (a) {
+ return (Object.prototype.toString.call(a) === "[object Array]");
+ },
+
+ matchOptionArrayString: function (src, attr, pattern) {
+ /* src.obj[attr] is a StringArray */
+ var _pattern, re, _stringMatch;
+ _pattern = this._wac2_regexSanitize(pattern);
+ re = new RegExp("^" + _pattern + "$", "i");
+
+ _stringMatch = function (obj, index) {
+ if (pattern.search(/^%*$/i) === 0)
+ return true;
+ if (obj[attr] === undefined || obj[attr] === null)
+ return false;
+ return obj[attr].some(function (f) {
+ return f.search(re) !== -1;
+ });
+ };
+ return utils.filter(src, _stringMatch);
+ },
+
+ matchOptionString: function (src, attr, pattern) {
+ /* src.obj[attr] is a string */
+ var _stringMatch, _pattern, _re;
+ _pattern = this._wac2_regexSanitize(pattern);
+ _re = new RegExp("^" + _pattern + "$", "mi");
+
+ _stringMatch = function (obj, index) {
+ return (obj[attr].search(_re) !== -1);
+ };
+ return utils.filter(src, _stringMatch);
+ },
+
+ matchOptionDate: function (src, attr, filterStart, filterEnd) {
+ var _dateMatch;
+ _dateMatch = function (obj, index) {
+ var matched = true, valueDate = obj[attr];
+
+ if (filterStart !== undefined && filterStart !== null) {
+ matched = (valueDate.getTime() >= filterStart.getTime());
+ }
+ if (matched && (filterEnd !== undefined && filterEnd !== null)) {
+ matched = (valueDate.getTime() <= filterEnd.getTime());
+ }
+ return matched;
+ };
+ return utils.filter(src, _dateMatch);
+ },
+
+ matchOptionShortArray: function (src, attr, filterArray) {
+ /* src.obj[attr] is a short, filterArray is an array
+ i.e. find status is [CONFRIMED or TENTATIVE] */
+ var arraySome = function (obj, index) {
+ return filterArray.some(function (f) {
+ return f === obj[attr];
+ });
+ };
+ return utils.filter(src, arraySome);
+ },
+
+ validateTypeMismatch: function (onSuccess, onError, name, callback) {
+ if (onSuccess) {
+ utils.validateArgumentType(onSuccess, "function", null,
+ name + " invalid successCallback parameter",
+ new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
+ }
+
+ if (onError) {
+ utils.validateArgumentType(onError, "function", null,
+ name + " invalid errorCallback parameter",
+ new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
+ }
+
+ if (onSuccess) {
+ return callback && callback();
+ } else {
+ if (onError) {
+ setTimeout(function () {
+ onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
+ }, 1);
+ }
+ }
+ return undefined;
+ },
+
+ isEmptyObject: function (obj) {
+ var prop;
+
+ for (prop in obj) {
+ return false;
+ }
+ return true;
+ }
+};
+
+
+});
+define('ripple/platform/wearable/2.0/WebAPIError', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var errorcode = require('ripple/platform/wearable/2.0/errorcode');
+
+var msg = {
+ 0: "Generic Error",
+ 1: "Index or size is negative, or greater than the allowed value.",
+ 2: "Specified range of text does not fit into a DOMString.",
+ 3: "Node is inserted somewhere it doesn't belong.",
+ 4: "Node is used in a different document than the one that created it (that doesn't support it).",
+ 5: "An invalid or illegal character is specified.",
+ 6: "Data is specified for a Node which does not support data.",
+ 7: "An attempt is made to modify an object where modifications are not allowed.",
+ 8: "An attempt is made to reference a Node in a context where it does not exist.",
+ 9: "The implementation does not support the requested type of object or operation.",
+ 10: "An attempt is made to add an attribute that is already in use elsewhere.",
+ 11: "An attempt is made to use an object that is not, or is no longer, usable.",
+ 12: "An invalid or illegal string is specified.",
+ 13: "An attempt is made to modify the type of the underlying object.",
+ 14: "An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.",
+ 15: "A parameter or an operation is not supported by the underlying object.",
+ 16: "A call to a method such as insertBefore or removeChild would make the Node invalid with respect to \"partial validity\", this exception would be raised and the operation would not be done.",
+ 17: "The type of an object is incompatible with the expected type of the parameter associated to the object.",
+ 18: "An attempt is made to perform an operation or access some data in a way that would be a security risk or a violation of the user agent's security policy.",
+ 19: "A network error occurs in synchronous requests.",
+ 20: "The abort error occurs in asynchronous requests by user prompt.",
+ 21: "The operation could not be completed because the URL does not match.",
+ 22: "The quota has been exceeded.",
+ 23: "The operation timed out.",
+ 24: "The supplied node is incorrect or has an incorrect ancestor for this operation.",
+ 25: "The object can not be cloned.",
+ 99: "The content of an object does not include valid values.",
+ 100: "Error occurred in communication with the underlying implementation that meant the requested method could not complete.",
+ 111: "Requested service is not available.",
+ 112: "The authentication token of remote peer agent is not generated.",
+ 113: "The remote Accessory Peer Agent already exists.",
+ 114: "The remote Accessory Peer Agent is unreachable or no longer available, perhaps it has been powered off or the connectivity has been turned off.",
+ 115: "The remote Accessory Peer Agent timedout.",
+ 116: "The remote Accessory Peer Agent rejected the request.",
+ 117: "The remote Accessory Peer Agent closed the Service Connection",
+ 118: "The remote Accessory Peer Agent Accessory Device has been detached.",
+ 119: "The remote peer rejected/cancelled the file request."
+ },
+ errType = {
+ 0: "UnknownError",
+ 1: "IndexSizeError",
+ 2: "DOMStringSizeError",
+ 3: "HierarchyRequestError",
+ 4: "WrongDocumentError",
+ 5: "InvalidCharacterError",
+ 6: "NoDataAllowedError",
+ 7: "NoModificationAllowedError",
+ 8: "NotFoundError",
+ 9: "NotSupportedError",
+ 10: "InuseAttributeError",
+ 11: "InvalidStateError",
+ 12: "SyntaxError",
+ 13: "InvalidModificationError",
+ 14: "NamespaceError",
+ 15: "InvalidAccessError",
+ 16: "ValidationError",
+ 17: "TypeMismatchError",
+ 18: "SecurityError",
+ 19: "NetworkError",
+ 20: "AbortError",
+ 21: "URLMismatchError",
+ 22: "QuotaExceededError",
+ 23: "TimeoutError",
+ 24: "InvalidNodeTypeError",
+ 25: "DataCloneError",
+ 99: "InvalidValuesError",
+ 100: "IOError",
+ 111: "ServiceNotAvailableError",
+ 112: "TokenNotGeneratedError",
+ 113: "AlreadyExistError",
+ 114: "DeviceUnreachableError",
+ 115: "PeerAgentNoResponseError",
+ 116: "PeerAgentRejectedError",
+ 117: "PeerDisconnectedError",
+ 118: "DeviceDetachecError",
+ 119: "PeerRejectedError"
+ };
+
+/*
+ support 3 types of error:
+ - WebAPIError()
+ code = errorcode.UNKNOWN_ERR
+ message = errorcode.message[UNKNOWN_ERR]
+ - WebAPIError(errorcode."TYPE_MISMATCH_ERR")
+ code = 17
+ message = errorcode.message[17]
+ - WebAPIError(my_own_error_code, "This is my error message.")
+ code = my_own_error_code(number)
+ message = "This is my error message."
+ */
+
+module.exports = function (code, message, name) {
+ var _code, _message, _name;
+
+ if (typeof code !== 'number') {
+ _code = errorcode.UNKNOWN_ERR;
+ _message = msg[_code];
+ _name = errType[_code];
+ } else {
+ _code = code;
+ if (typeof message === 'string') {
+ _message = message;
+ } else {
+ _message = msg[_code];
+ }
+ if (typeof name === 'string') {
+ _name = name;
+ } else {
+ _name = errType[_code];
+ }
+ }
+
+ this.__defineGetter__("code", function () {
+ return _code;
+ });
+ this.__defineGetter__("message", function () {
+ return _message;
+ });
+ this.__defineGetter__("name", function () {
+ return _name;
+ });
+};
+
+});
+define('ripple/platform/wearable/2.0/WebAPIException', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var errorcode = require('ripple/platform/wearable/2.0/errorcode');
+
+var msg = {
+ 0: "Generic Error",
+ 1: "Index or size is negative, or greater than the allowed value.",
+ 2: "Specified range of text does not fit into a DOMString.",
+ 3: "Node is inserted somewhere it doesn't belong.",
+ 4: "Node is used in a different document than the one that created it (that doesn't support it).",
+ 5: "An invalid or illegal character is specified.",
+ 6: "Data is specified for a Node which does not support data.",
+ 7: "An attempt is made to modify an object where modifications are not allowed.",
+ 8: "An attempt is made to reference a Node in a context where it does not exist.",
+ 9: "The implementation does not support the requested type of object or operation.",
+ 10: "An attempt is made to add an attribute that is already in use elsewhere.",
+ 11: "An attempt is made to use an object that is not, or is no longer, usable.",
+ 12: "An invalid or illegal string is specified.",
+ 13: "An attempt is made to modify the type of the underlying object.",
+ 14: "An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.",
+ 15: "A parameter or an operation is not supported by the underlying object.",
+ 16: "A call to a method such as insertBefore or removeChild would make the Node invalid with respect to \"partial validity\", this exception would be raised and the operation would not be done.",
+ 17: "The type of an object is incompatible with the expected type of the parameter associated to the object.",
+ 18: "An attempt is made to perform an operation or access some data in a way that would be a security risk or a violation of the user agent's security policy.",
+ 19: "A network error occurs in synchronous requests.",
+ 20: "The abort error occurs in asynchronous requests by user prompt.",
+ 21: "The operation could not be completed because the URL does not match.",
+ 22: "The quota has been exceeded.",
+ 23: "The operation timed out.",
+ 24: "The supplied node is incorrect or has an incorrect ancestor for this operation.",
+ 25: "The object can not be cloned.",
+ 99: "The content of an object does not include valid values.",
+ 100: "Error occurred in communication with the underlying implementation that meant the requested method could not complete.",
+ 111: "Requested service is not available.",
+ 112: "The authentication token of remote peer agent is not generated.",
+ 113: "The remote Accessory Peer Agent already exists.",
+ 114: "The remote Accessory Peer Agent is unreachable or no longer available, perhaps it has been powered off or the connectivity has been turned off.",
+ 115: "The remote Accessory Peer Agent timedout.",
+ 116: "The remote Accessory Peer Agent rejected the request.",
+ 117: "The remote Accessory Peer Agent closed the Service Connection",
+ 118: "The remote Accessory Peer Agent Accessory Device has been detached.",
+ 119: "The remote peer rejected/cancelled the file request."
+ },
+ errType = {
+ 0: "UnknownError",
+ 1: "IndexSizeError",
+ 2: "DOMStringSizeError",
+ 3: "HierarchyRequestError",
+ 4: "WrongDocumentError",
+ 5: "InvalidCharacterError",
+ 6: "NoDataAllowedError",
+ 7: "NoModificationAllowedError",
+ 8: "NotFoundError",
+ 9: "NotSupportedError",
+ 10: "InuseAttributeError",
+ 11: "InvalidStateError",
+ 12: "SyntaxError",
+ 13: "InvalidModificationError",
+ 14: "NamespaceError",
+ 15: "InvalidAccessError",
+ 16: "ValidationError",
+ 17: "TypeMismatchError",
+ 18: "SecurityError",
+ 19: "NetworkError",
+ 20: "AbortError",
+ 21: "URLMismatchError",
+ 22: "QuotaExceededError",
+ 23: "TimeoutError",
+ 24: "InvalidNodeTypeError",
+ 25: "DataCloneError",
+ 99: "InvalidValuesError",
+ 100: "IOError",
+ 111: "ServiceNotAvailableError",
+ 112: "TokenNotGeneratedError",
+ 113: "AlreadyExistError",
+ 114: "DeviceUnreachableError",
+ 115: "PeerAgentNoResponseError",
+ 116: "PeerAgentRejectedError",
+ 117: "PeerDisconnectedError",
+ 118: "DeviceDetachecError",
+ 119: "PeerRejectedError"
+ };
+
+/*
+ support 3 types of error:
+ - WebAPIError()
+ code = errorcode.UNKNOWN_ERR
+ message = errorcode.message[UNKNOWN_ERR]
+ - WebAPIError(errorcode."TYPE_MISMATCH_ERR")
+ code = 17
+ message = errorcode.message[17]
+ - WebAPIError(my_own_error_code, "This is my error message.")
+ code = my_own_error_code(number)
+ message = "This is my error message."
+ */
+
+module.exports = function (code, message, name) {
+ var _code, _message, _name;
+
+ if (typeof code !== 'number') {
+ _code = errorcode.UNKNOWN_ERR;
+ _message = msg[_code];
+ _name = errType[_code];
+ } else {
+ _code = code;
+ if (typeof message === 'string') {
+ _message = message;
+ } else {
+ _message = msg[_code];
+ }
+ if (typeof name === 'string') {
+ _name = name;
+ } else {
+ _name = errType[_code];
+ }
+ }
+
+ this.__defineGetter__("code", function () {
+ return _code;
+ });
+ this.__defineGetter__("message", function () {
+ return _message;
+ });
+ this.__defineGetter__("name", function () {
+ return _name;
+ });
+};
+
+});
+define('ripple/platform/wearable/2.0/dbinit', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var exception = require('ripple/exception'),
+ DBBuilder,
+ _data = {
+ dbBuilder: null
+ },
+ _self = {};
+
+function _initialize() {
+ _data.dbBuilder = new DBBuilder();
+}
+
+DBBuilder = function () {
+ var self;
+
+ // private
+ function formatString(str) {
+ return str.replace(/^\s+|[\t\n\r\v]+|\s+$/g, "").replace(/\s+/g, "");
+ }
+
+ // private
+ function formatHex(str) {
+ return str.replace(/,(0x[0-9a-fA-F]+?),/g, ',"$1",');
+ }
+
+ // public
+ function register(type, dbFile, Extension) {
+ _data[type] = Extension ? new Extension() : {};
+
+ if (!dbFile)
+ return;
+
+ _self.__defineGetter__(type, function () {
+ var fnInit;
+
+ if (!_data[type].db) {
+ fnInit = _data[type].initdb || initdb;
+ _data[type].db = fnInit(dbFile);
+ }
+
+ return _data[type].db;
+ });
+ }
+
+ function initdb(dbFile) {
+ var xmlHttp, res;
+
+ try {
+ xmlHttp = new XMLHttpRequest();
+ xmlHttp.open("GET", "dbsamples/" + dbFile, false);
+ xmlHttp.send();
+ } catch (e) {
+ exception.handle(e);
+ }
+
+ if (!xmlHttp.responseText) {
+ return null;
+ }
+
+ res = formatHex(formatString(xmlHttp.responseText));
+
+ return JSON.parse(res);
+ }
+
+ self = {
+ register: register,
+ initdb: initdb
+ };
+
+ return self;
+};
+
+_initialize();
+
+module.exports = _self;
+
+});
+define('ripple/platform/wearable/2.0/errorcode', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"),
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var _self = {};
+
+_self.__defineGetter__("UNKNOWN_ERR", function () {
+ return 0;
+});
+
+_self.__defineGetter__("INDEX_SIZE_ERR", function () {
+ return 1;
+});
+
+_self.__defineGetter__("DOMSTRING_SIZE_ERR", function () {
+ return 2;
+});
+
+_self.__defineGetter__("HIERARCHY_REQUEST_ERR", function () {
+ return 3;
+});
+
+_self.__defineGetter__("WRONG_DOCUMENT_ERR", function () {
+ return 4;
+});
+
+_self.__defineGetter__("INVALID_CHARACTER_ERR", function () {
+ return 5;
+});
+
+_self.__defineGetter__("NO_DATA_ALLOWED_ERR", function () {
+ return 6;
+});
+
+_self.__defineGetter__("NO_MODIFICATION_ALLOWED_ERR", function () {
+ return 7;
+});
+
+_self.__defineGetter__("NOT_FOUND_ERR", function () {
+ return 8;
+});
+
+_self.__defineGetter__("NOT_SUPPORTED_ERR", function () {
+ return 9;
+});
+
+_self.__defineGetter__("INUSE_ATTRIBUTE_ERR", function () {
+ return 10;
+});
+
+_self.__defineGetter__("INVALID_STATE_ERR", function () {
+ return 11;
+});
+
+_self.__defineGetter__("SYNTAX_ERR", function () {
+ return 12;
+});
+
+_self.__defineGetter__("INVALID_MODIFICATION_ERR", function () {
+ return 13;
+});
+
+_self.__defineGetter__("NAMESPACE_ERR", function () {
+ return 14;
+});
+
+_self.__defineGetter__("INVALID_ACCESS_ERR", function () {
+ return 15;
+});
+
+_self.__defineGetter__("VALIDATION_ERR", function () {
+ return 16;
+});
+
+_self.__defineGetter__("TYPE_MISMATCH_ERR", function () {
+ return 17;
+});
+
+_self.__defineGetter__("SECURITY_ERR", function () {
+ return 18;
+});
+
+_self.__defineGetter__("NETWORK_ERR", function () {
+ return 19;
+});
+
+_self.__defineGetter__("ABORT_ERR", function () {
+ return 20;
+});
+
+_self.__defineGetter__("URL_MISMATCH_ERR", function () {
+ return 21;
+});
+
+_self.__defineGetter__("QUOTA_EXCEEDED_ERR", function () {
+ return 22;
+});
+
+_self.__defineGetter__("TIMEOUT_ERR", function () {
+ return 23;
+});
+
+_self.__defineGetter__("INVALID_NODE_TYPE_ERR", function () {
+ return 24;
+});
+
+_self.__defineGetter__("DATA_CLONE_ERR", function () {
+ return 25;
+});
+
+_self.__defineGetter__("INVALID_VALUES_ERR", function () {
+ return 99;
+});
+
+_self.__defineGetter__("IO_ERR", function () {
+ return 100;
+});
+
+_self.__defineGetter__("SERVICE_NOT_AVAILABLE_ERR", function () {
+ return 111;
+});
+
+_self.__defineGetter__("TOKEN_NOT_GENERATED_ERR", function () {
+ return 112;
+});
+
+_self.__defineGetter__("ALREADY_EXIST", function () {
+ return 113;
+});
+
+_self.__defineGetter__("DEVICE_UNREACHABLE", function () {
+ return 114;
+});
+
+_self.__defineGetter__("PEERAGENT_NO_RESPONSE", function () {
+ return 115;
+});
+
+_self.__defineGetter__("PEERAGENT_REJECTED", function () {
+ return 116;
+});
+
+_self.__defineGetter__("PEER_DISCONNECTED", function () {
+ return 117;
+});
+
+_self.__defineGetter__("DEVICE_DETACHED", function () {
+ return 118;
+});
+
+_self.__defineGetter__("PEER_REJECTED", function () {
+ return 119;
+});
+
+module.exports = _self;
+
+
+});
+define('ripple/platform/wearable/2.0/irled', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var t = require('ripple/platform/wearable/2.0/typecast'),
+ event = require('ripple/event'),
+ errorcode = require('ripple/platform/wearable/2.0/errorcode'),
+ WebAPIException = require('ripple/platform/wearable/2.0/WebAPIException'),
+ _security = {
+ "http://developer.samsung.com/privilege/irled": ["send"]
+ },
+ _self;
+
+_self = function () {
+ var irled;
+
+ function send(data, successCallback, errorCallback) {
+ if (!_security.send) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.IrLedManager("send", arguments);
+
+ window.setTimeout(function () {
+ event.trigger("irled-send-data", [data]);
+
+ if (successCallback) {
+ successCallback();
+ }
+ }, 1);
+ }
+
+ function handleSubFeatures(subFeatures) {
+ var i, subFeature;
+
+ for (subFeature in subFeatures) {
+ for (i in _security[subFeature]) {
+ _security[_security[subFeature][i]] = true;
+ }
+ }
+ }
+
+ irled = {
+ send: send,
+ handleSubFeatures: handleSubFeatures
+ };
+
+ return irled;
+};
+
+module.exports = _self;
+
+});
+define('ripple/platform/wearable/2.0/motion', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var db = require('ripple/db'),
+ event = require('ripple/event'),
+ t = require('ripple/platform/wearable/2.0/typecast'),
+ errorcode = require('ripple/platform/wearable/2.0/errorcode'),
+ WebAPIException = require('ripple/platform/wearable/2.0/WebAPIException'),
+ WebAPIError = require('ripple/platform/wearable/2.0/WebAPIError'),
+ MotionInfo,
+ MotionPedometerInfo,
+ _security = {
+ "http://developer.samsung.com/privilege/healthinfo": ["getMotionInfo",
+ "start", "stop"]
+ },
+ _data = {
+ MOTIONINFO: {
+ WALKING: {
+ // speed(km/h):4.1~5.6, step(f/m): 90~120.
+ speed: [4.2, 4.4, 4.5, 4.7, 4.8, 4.9, 5.0, 5.1, 5.3, 5.5],
+ frequency: [1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.2],
+ calorie: [0.04, 0.05 ,0.06 ,0.07, 0.08, 0.09, 0.10, 0.11, 0.12,
+ 0.13],
+ },
+ RUNNING: {
+ speed: [17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0,
+ 26.0],
+ frequency: [5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0],
+ calorie: [0.15, 0.17, 0.19, 0.21, 0.23, 0.25, 0.27, 0.29, 0.31,
+ 0.33],
+ }
+ },
+ tMotionStart: null,
+ motionInfo: null,
+ motionObject: null,
+ motionCB: null
+ },
+ _self;
+
+function _initialize() {
+ _data.motionInfo = db.retrieveObject("wearable-motion-data") || {
+ stepStatus: "NOT_MOVING",
+ speed: 0,
+ walkingFrequency: 0,
+ cumulativeDistance: 0,
+ cumulativeCalorie: 0,
+ cumulativeWalkStepCount: 0,
+ cumulativeRunStepCount: 0
+ };
+
+ _stopMotionCount();
+}
+
+function _startMotionCount() {
+ var count = 0, status = "WALKING";
+ _data.tMotionStart = window.setInterval(function () {
+ var index, speed, frequency, distance, calorie,
+ walkStepCount, runStepCount;
+
+ if (count === 60) {
+ status = (status === "WALKING") ? "RUNNING" : "WALKING";
+ count = 0;
+ }
+ count++;
+
+ index = Math.floor((Math.random() * 4));
+ speed = _data.MOTIONINFO[status].speed[index];
+ frequency = _data.MOTIONINFO[status].frequency[index];
+ distance = _data.MOTIONINFO[status].speed[index] / 3.6;
+ calorie = _data.MOTIONINFO[status].calorie[index];
+ walkStepCount = _data.MOTIONINFO[status].frequency[index];
+ runStepCount = _data.MOTIONINFO[status].frequency[index];
+
+
+ _data.motionInfo.stepStatus = status;
+ _data.motionInfo.speed = speed;
+ _data.motionInfo.walkingFrequency = frequency;
+ _data.motionInfo.cumulativeDistance += distance;
+ _data.motionInfo.cumulativeCalorie += calorie;
+ if (status === "WALKING") {
+ _data.motionInfo.cumulativeWalkStepCount += walkStepCount;
+ }
+ if (status === "RUNNING") {
+ _data.motionInfo.cumulativeRunStepCount += runStepCount;
+ }
+ _data.motionInfo.cumulativeTotalStepCount =
+ _data.motionInfo.cumulativeWalkStepCount +
+ _data.motionInfo.cumulativeRunStepCount;
+
+ _motionCallback();
+ db.saveObject("wearable-motion-data", _data.motionInfo);
+ event.trigger("wearable-motion-pedometer-data", [_formatMotionData()]);
+ }, 1000);
+}
+
+function _formatMotionData() {
+ var motionInfo = {}, key;
+
+ function _format(value) {
+ return Math.round(value * 100) / 100;
+ }
+
+ for (key in _data.motionInfo) {
+ if (key === "stepStatus") {
+ motionInfo[key] = _data.motionInfo[key];
+ continue;
+ }
+ motionInfo[key] = _format(_data.motionInfo[key]);
+ }
+
+ return motionInfo;
+}
+
+function _motionCallback() {
+ var motionInfo = _formatMotionData(_data.motionInfo);
+ _data.motionObject = new MotionPedometerInfo(motionInfo);
+ if (_data.motionCB) {
+ _data.motionCB(_data.motionObject);
+ }
+}
+
+function _stopMotionCount() {
+ if (_data.tMotionStart) {
+ window.clearInterval(_data.tMotionStart);
+ }
+
+ _data.motionInfo.speed = 0;
+ _data.motionInfo.walkingFrequency = 0;
+ _data.motionInfo.stepStatus = "NOT_MOVING";
+ event.trigger("wearable-motion-pedometer-data", [_formatMotionData()]);
+}
+
+_self = function () {
+ var motion;
+
+ function getMotionInfo(type, successCallback, errorCallback) {
+ if (!_security.getMotionInfo) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.MotionManager("getMotionInfo", arguments);
+
+ if (type === "WRIST_UP") {
+ // Only supports the PEDOMETER type.
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ if (!_data.isMotionStart) {
+ throw new WebAPIException(errorcode.SERVICE_NOT_AVAILABLE_ERR);
+ }
+
+ window.setTimeout(function () {
+ if (!_data.motionInfo) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(errorcode.UNKNOWN_ERR));
+ }
+ return;
+ }
+ successCallback(_data.motionObject);
+ }, 1);
+ }
+
+ function start(type, successCallback) {
+ if (!_security.start) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.MotionManager("start", arguments);
+
+ if (type === "WRIST_UP") {
+ // Only supports the PEDOMETER type.
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ if (_data.isMotionStart)
+ return;
+
+ _startMotionCount();
+ if (successCallback) {
+ _data.motionCB = successCallback;
+ }
+ }
+
+ function stop(type) {
+ if (!_security.stop) {
+ throw new WebAPIException(errorcode.SECURITY_ERR);
+ }
+
+ t.MotionManager("stop", arguments);
+
+ if (type === "WRIST_UP") {
+ // Only supports the PEDOMETER type.
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ _stopMotionCount();
+ _data.motionCB = null;
+ }
+
+ function handleSubFeatures(subFeatures) {
+ var i, subFeature;
+
+ for (subFeature in subFeatures) {
+ for (i in _security[subFeature]) {
+ _security[_security[subFeature][i]] = true;
+ }
+ }
+ }
+
+ motion = {
+ getMotionInfo: getMotionInfo,
+ start: start,
+ stop: stop,
+ handleSubFeatures: handleSubFeatures
+ };
+
+ return motion;
+};
+
+MotionInfo = function () {};
+
+MotionPedometerInfo = function (attributes) {
+ var info = {};
+
+ MotionInfo.call(this, attributes);
+
+ info.stepStatus = attributes.stepStatus || "NOT_MOVING";
+ info.speed = attributes.speed || 0;
+ info.walkingFrequency = attributes.walkingFrequency || 0;
+ info.cumulativeDistance = attributes.cumulativeDistance || 0;
+ info.cumulativeCalorie = attributes.cumulativeCalorie || 0;
+ info.cumulativeTotalStepCount = attributes.cumulativeTotalStepCount || 0;
+ info.cumulativeWalkStepCount = attributes.cumulativeWalkStepCount || 0;
+ info.cumulativeRunStepCount = attributes.cumulativeRunStepCount || 0;
+
+ this.__defineGetter__("stepStatus", function () {
+ return info.stepStatus;
+ });
+
+ this.__defineGetter__("speed", function () {
+ return info.speed;
+ });
+
+ this.__defineGetter__("walkingFrequency", function () {
+ return info.walkingFrequency;
+ });
+
+ this.__defineGetter__("cumulativeDistance", function () {
+ return info.cumulativeDistance;
+ });
+
+ this.__defineGetter__("cumulativeCalorie", function () {
+ return info.cumulativeCalorie;
+ });
+
+ this.__defineGetter__("cumulativeTotalStepCount", function () {
+ return info.cumulativeTotalStepCount;
+ });
+
+ this.__defineGetter__("cumulativeWalkStepCount", function () {
+ return info.cumulativeWalkStepCount;
+ });
+
+ this.__defineGetter__("cumulativeRunStepCount", function () {
+ return info.cumulativeRunStepCount;
+ });
+};
+
+_initialize();
+
+module.exports = _self;
+
+});
+define('ripple/platform/wearable/2.0/sa', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var app = require('ripple/app'),
+ event = require('ripple/event'),
+ utils = require('ripple/utils'),
+ t = require('ripple/platform/wearable/2.0/typecast'),
+ errorcode = require('ripple/platform/wearable/2.0/errorcode'),
+ WebAPIException = require('ripple/platform/wearable/2.0/WebAPIException'),
+ WebAPIError = require('ripple/platform/wearable/2.0/WebAPIError'),
+ SAAgent,
+ SAAuthenticationToken,
+ SAPeerAccessory,
+ SAPeerAgent,
+ SASocket,
+ SAFileTransfer,
+ _security = {
+ "http://developer.samsung.com/privilege/accessoryprotocol": [
+ "requestSAAgent", "setDeviceStatusListener"
+ ]
+ },
+ _data = {
+ SA_PEER_AGENT: [{
+ peerAccessory: {
+ deviceAddress: "78:2b:cb:85:2d:c5",
+ deviceName: "Samsung Galaxy S5(U.S. Cellular),",
+ productId: "Galaxy S5",
+ transportType: "TRANSPORT_USB",
+ vendorId: "0x163C"
+ },
+ appName: "GearSampleProvider",
+ maxAllowedDataSize: 1024,
+ peerId: "85ed28a031aaf284097edf09ffec3f21",
+ profileVersion: "2.0"
+ }],
+ DEFAULT_RECEIVE_PATH: "/tmp/",
+ profiles: null,
+ saAgents: [],
+ peerAgents: [],
+ deviceStatusListener: null,
+ saFileTransfer: {},
+ agents: null,
+ isAttached: "ATTACHED"
+ },
+ _self;
+
+function _xmlToJson(xml) {
+ var obj = {}, i, j, attribute, item, nodeName;
+
+ if (xml.nodeType === 1) { // element
+ // do attributes
+ if (xml.attributes.length > 0) {
+ for (j = 0; j < xml.attributes.length; j++) {
+ attribute = xml.attributes.item(j);
+ obj[attribute.nodeName] = attribute.nodeValue;
+ }
+ }
+ } else if (xml.nodeType === 3) { // text
+ obj = xml.nodeValue.trim();
+ }
+
+ // do children
+ if (xml.hasChildNodes()) {
+ for (i = 0; i < xml.childNodes.length; i++) {
+ item = xml.childNodes.item(i);
+ nodeName = item.nodeName;
+
+ if (nodeName === "#text")
+ continue;
+
+ if (typeof(obj[nodeName]) === "undefined") {
+ obj[nodeName] = _xmlToJson(item);
+ }
+ else {
+ if (typeof(obj[nodeName].push) === "undefined") {
+ var old = obj[nodeName];
+ obj[nodeName] = [];
+ obj[nodeName].push(old);
+ }
+ obj[nodeName].push(_xmlToJson(item));
+ }
+ }
+ }
+
+ return obj;
+}
+
+function _readServiceProfile() {
+ var xmlHttp = new XMLHttpRequest(),
+ resourcePath;
+
+ if (!app.getInfo().metadata) {
+ return;
+ }
+
+ if (app.getInfo().metadata.key === "AccessoryServicesLocation") {
+ resourcePath = app.getInfo().metadata.value;
+ }
+ if (!resourcePath) {
+ return;
+ }
+
+ xmlHttp.open("GET", utils.appLocation() + resourcePath, false);
+ xmlHttp.send();
+
+ if (xmlHttp.responseXML) {
+ _data.profiles = _xmlToJson(xmlHttp.responseXML);
+ }
+}
+
+function _initSAAgent() {
+ var application, profiles, i, saAgent, id = [];
+
+ if (!_data.profiles || !_data.profiles.resources ||
+ !_data.profiles.resources.application) {
+ return;
+ }
+ application = _data.profiles.resources.application;
+ profiles = application.serviceProfile;
+
+ if (profiles) {
+ _data.agents = {};
+ if (profiles instanceof Array) {
+ for (i = 0; i < profiles.length; i++) {
+ profiles[i].role = profiles[i].role.toUpperCase();
+ saAgent = new SAAgent(profiles[i]);
+
+ _data.saAgents.push(saAgent);
+ _data.agents[saAgent.id] = saAgent;
+ id.push(saAgent.id);
+ }
+ }
+ else {
+ profiles.role = profiles.role.toUpperCase();
+ saAgent = new SAAgent(profiles);
+ _data.saAgents.push(saAgent);
+ _data.agents[saAgent.id] = saAgent;
+ id.push(saAgent.id);
+ }
+ event.trigger("wearableSAAgentsValid", [id]);
+ }
+}
+
+function _simulatedPeerAgents() {
+ var peerAgents = utils.copy(_data.SA_PEER_AGENT),
+ peerAgent, peerAccessory,
+ i;
+
+ for (i = 0; i < peerAgents.length; i++) {
+ peerAccessory = new SAPeerAccessory(peerAgents[i].peerAccessory);
+ peerAgents[i].peerAccessory = peerAccessory;
+
+ peerAgent = new SAPeerAgent(peerAgents[i]);
+ _data.peerAgents.push(peerAgent);
+ }
+ event.trigger("wearablePeerAgentsSimulated", [_data.peerAgents]);
+}
+
+function _getRemotePeerAgentToken(peerAgent) {
+ return peerAgent.peerId;
+}
+
+function _initialize() {
+ _readServiceProfile();
+ _initSAAgent();
+ _simulatedPeerAgents();
+}
+
+_self = function () {
+ var sa;
+
+ function requestSAAgent(successCallback, errorCallback) {
+ if (!_security.requestSAAgent) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.SAManager("requestSAAgent", arguments);
+
+ window.setTimeout(function () {
+ if (!_data.saAgents || _data.saAgents.length === 0) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.SERVICE_NOT_AVAILABLE_ERR));
+ }
+ return;
+ }
+
+ successCallback(_data.saAgents);
+ }, 1);
+ }
+
+ function setDeviceStatusListener(callback) {
+ if (!_security.setDeviceStatusListener) {
+ throw new WebAPIException(errorcode.PERMISSION_DENIED);
+ }
+
+ t.SAManager("setDeviceStatusListener", arguments);
+
+ _data.deviceStatusListener = callback;
+ }
+
+ function handleSubFeatures(subFeatures) {
+ var i, subFeature;
+
+ for (subFeature in subFeatures) {
+ for (i in _security[subFeature]) {
+ _security[_security[subFeature][i]] = true;
+ }
+ }
+ }
+
+ sa = {
+ requestSAAgent: requestSAAgent,
+ setDeviceStatusListener: setDeviceStatusListener,
+ handleSubFeatures: handleSubFeatures
+ };
+
+ return sa;
+};
+
+event.on("wearableDeviceDetached", function (type, status) {
+ var agentId, peerId;
+
+ _data.isAttached = status;
+ if (_data.deviceStatusListener) {
+ _data.deviceStatusListener(type, status);
+ }
+
+ for (agentId in _data.agents) {
+ for (peerId in _data.agents[agentId].socket) {
+ if (_data.agents[agentId].socket[peerId].socketStatus) {
+ _data.agents[agentId].socket[peerId].socketStatus(
+ new WebAPIError(errorcode.DEVICE_DETACHED));
+ }
+ }
+ delete _data.agents[agentId].socket;
+ }
+});
+
+SAAgent = function (attributes) {
+ var saAgent = {};
+
+ saAgent.id = attributes.id || "";
+ saAgent.name = attributes.name || "";
+ saAgent.role = attributes.role || "";
+ saAgent.channelIds = attributes.channelIds || [];
+
+ this.__defineGetter__("id", function () {
+ return saAgent.id;
+ });
+
+ this.__defineGetter__("name", function () {
+ return saAgent.name;
+ });
+
+ this.__defineGetter__("role", function () {
+ return saAgent.role;
+ });
+
+ this.__defineGetter__("channelIds", function () {
+ return saAgent.channelIds;
+ });
+
+ this.requestServiceConnection = function (peerAgent) {
+ var agentId = saAgent.id;
+
+ t.SAAgent("requestServiceConnection", arguments);
+
+ if (_data.isAttached === "DETACHED") {
+ event.on("wearableServiceConnected", [agentId,
+ peerAgent, "DEVICE_UNREACHABLE"]);
+ return;
+ }
+ event.trigger("wearableServiceRequested", [agentId,
+ peerAgent]);
+ };
+
+ this.setServiceConnectionListener = function (callback) {
+ t.SAAgent("setServiceConnectionListener", arguments);
+
+ _data.agents[saAgent.id].serviceConnection = callback;
+ };
+
+ this.authenticatePeerAgent = function (peerAgent, successCallback,
+ errorCallback) {
+ t.SAAgent("authenticatePeerAgent", arguments);
+
+ window.setTimeout(function () {
+ var authToken = _getRemotePeerAgentToken(peerAgent);
+
+ if (!authToken) {
+ if (errorCallback) {
+ errorCallback(new WebAPIError(
+ errorcode.TOKEN_NOT_GENERATED_ERR));
+ }
+ return;
+ }
+
+ successCallback(peerAgent, authToken);
+ }, 1);
+ };
+
+ this.acceptServiceConnectionRequest = function (peerAgent) {
+ t.SAAgent("acceptServiceConnectionRequest", arguments);
+
+ event.trigger("wearableRemoteServiceConnected", [true, peerAgent]);
+ };
+
+ this.rejectServiceConnectionRequest = function (peerAgent) {
+ t.SAAgent("rejectServiceConnectionRequest", arguments);
+
+ event.trigger("wearableRemoteServiceConnected", [false, peerAgent]);
+ };
+
+ this.findPeerAgents = function () {
+ var peerAgentFindListener, i;
+
+ t.SAAgent("findPeerAgents", arguments);
+
+ if (!_data.peerAgents)
+ return;
+
+ _data.isAttached = "ATTACHED";
+ for (i = 0; i < _data.peerAgents.length; i++) {
+ peerAgentFindListener = _data.agents[saAgent.id].peerAgentFind;
+ if (peerAgentFindListener &&
+ peerAgentFindListener.onpeeragentfound) {
+ peerAgentFindListener.onpeeragentfound(_data.peerAgents[i]);
+ }
+ }
+
+ event.trigger("wearableDeviceAttached");
+ };
+
+ this.setPeerAgentFindListener = function (callback) {
+ t.SAAgent("setPeerAgentFindListener", arguments);
+
+ _data.agents[saAgent.id].peerAgentFind = callback;
+ };
+
+ this.getSAFileTransfer = function () {
+ t.SAAgent("getSAFileTransfer", arguments);
+
+ return new SAFileTransfer(_data.DEFAULT_RECEIVE_PATH);
+ };
+};
+
+event.on("wearableServiceConnected", function (agentId, peerAgent,
+ status) {
+ var serviceConnectionListener, socket;
+
+ serviceConnectionListener = _data.agents[agentId].serviceConnection;
+ if (status !== "OK") {
+ if (serviceConnectionListener && serviceConnectionListener.onerror) {
+ serviceConnectionListener.onerror(new WebAPIError(
+ errorcode[status]));
+ }
+ return;
+ }
+
+ if (serviceConnectionListener && serviceConnectionListener.onconnect) {
+ peerAgent.agentId = agentId;
+ socket = new SASocket(peerAgent);
+
+ if (!_data.agents[agentId].socket) {
+ _data.agents[agentId].socket = {};
+ }
+ _data.agents[agentId].socket[peerAgent.peerId] = socket;
+ _data.agents[agentId].socket[peerAgent.peerId].isConnect = true;
+ serviceConnectionListener.onconnect(socket);
+ }
+});
+
+event.on("wearableRemoteServiceRequested", function (agentId, peerAgent) {
+ var serviceConnectionListener;
+
+ serviceConnectionListener = _data.agents[agentId].serviceConnection;
+ if (serviceConnectionListener && serviceConnectionListener.onrequest) {
+ serviceConnectionListener.onrequest(peerAgent);
+ }
+});
+
+SAAuthenticationToken = function (attributes) {
+ var saAuthenticationToken = {};
+
+ saAuthenticationToken.authenticationType =
+ attributes.authenticationType || "";
+ saAuthenticationToken.key = attributes.key || "";
+
+ this.__defineGetter__("authenticationType", function () {
+ return saAuthenticationToken.authenticationType;
+ });
+
+ this.__defineGetter__("key", function () {
+ return saAuthenticationToken.key;
+ });
+};
+
+SAPeerAccessory = function (attributes) {
+ var saPeerAccessory = {};
+
+ saPeerAccessory.deviceAddress = attributes.deviceAddress || "";
+ saPeerAccessory.deviceName = attributes.deviceName || "";
+ saPeerAccessory.productId = attributes.productId || "";
+ saPeerAccessory.transportType = attributes.transportType || "";
+ saPeerAccessory.vendorId = attributes.vendorId || "";
+
+ this.__defineGetter__("deviceAddress", function () {
+ return saPeerAccessory.deviceAddress;
+ });
+
+ this.__defineGetter__("deviceName", function () {
+ return saPeerAccessory.deviceName;
+ });
+
+ this.__defineGetter__("productId", function () {
+ return saPeerAccessory.productId;
+ });
+
+ this.__defineGetter__("transportType", function () {
+ return saPeerAccessory.transportType;
+ });
+
+ this.__defineGetter__("vendorId", function () {
+ return saPeerAccessory.vendorId;
+ });
+};
+
+SAPeerAgent = function (attributes) {
+ var saPeerAgent = {};
+
+ saPeerAgent.peerAccessory = attributes.peerAccessory || {};
+ saPeerAgent.appName = attributes.appName || "";
+ saPeerAgent.maxAllowedDataSize = attributes.maxAllowedDataSize || 0;
+ saPeerAgent.peerId = attributes.peerId || "";
+ saPeerAgent.profileVersion = attributes.profileVersion || "";
+
+ this.__defineGetter__("peerAccessory", function () {
+ return saPeerAgent.peerAccessory;
+ });
+
+ this.__defineGetter__("appName", function () {
+ return saPeerAgent.appName;
+ });
+
+ this.__defineGetter__("maxAllowedDataSize", function () {
+ return saPeerAgent.maxAllowedDataSize;
+ });
+
+ this.__defineGetter__("peerId", function () {
+ return saPeerAgent.peerId;
+ });
+
+ this.__defineGetter__("profileVersion", function () {
+ return saPeerAgent.profileVersion;
+ });
+};
+
+SASocket = function (peerAgent) {
+ var saSocket = {};
+
+ saSocket.peerAgent = peerAgent || {};
+
+ this.__defineGetter__("peerAgent", function () {
+ return saSocket.peerAgent;
+ });
+
+ function sendSocketData(iSecure, channelId, data) {
+ event.trigger("wearableSocketDataSent", [iSecure, channelId, data]);
+ }
+
+ this.close = function () {
+ var agentId = saSocket.peerAgent.agentId,
+ peerId = saSocket.peerAgent.peerId;
+
+ if (_data.agents[agentId] &&
+ _data.agents[agentId].socket[peerId] &&
+ _data.agents[agentId].socket[peerId].isConnect) {
+ _data.agents[agentId].socket[peerId].isConnect = false;
+
+ if (_data.agents[agentId].socket[peerId].socketStatus) {
+ _data.agents[agentId].socket[peerId].socketStatus(
+ new WebAPIError(errorcode.PEER_DISCONNECTED));
+ }
+
+ event.trigger("wearableSocketClosed");
+ }
+ };
+
+ this.isConnected = function () {
+ var agentId = saSocket.peerAgent.agentId,
+ peerId = saSocket.peerAgent.peerId;
+
+ if (_data.agents[agentId] &&
+ _data.agents[agentId].socket[peerId] &&
+ _data.agents[agentId].socket[peerId].isConnect) {
+ return true;
+ }
+ return false;
+ };
+
+ this.sendData = function (channelId, data) {
+ var maxSize = saSocket.peerAgent.maxAllowedDataSize,
+ agentId = saSocket.peerAgent.agentId;
+
+ t.SASocket("sendData", arguments);
+
+ if (!_data.agents[agentId] || !_data.agents[agentId].channelIds &&
+ _data.agents[agentId].channelIds.indexOf(channelId) === -1) {
+ throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
+ }
+ if (data.length * 8 > maxSize) {
+ throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
+ }
+ sendSocketData(false, channelId, data);
+ };
+
+ this.sendSecureData = function (channelId, data) {
+ var maxSize = saSocket.peerAgent.maxAllowedDataSize,
+ agentId = saSocket.peerAgent.agentId;
+
+ t.SASocket("sendSecureData", arguments);
+
+ if (!_data.agents[agentId] || !_data.agents[agentId].channelIds &&
+ _data.agents[agentId].channelIds.indexOf(channelId) === -1) {
+ throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
+ }
+ if (data.length * 8 > maxSize) {
+ throw new WebAPIException(errorcode.INVALID_VALUES_ERR);
+ }
+ sendSocketData(true, channelId, data);
+ };
+
+ this.setDataReceiveListener = function (callback) {
+ var agentId = saSocket.peerAgent.agentId,
+ peerId = saSocket.peerAgent.peerId;
+
+ t.SASocket("setDataReceiveListener", arguments);
+
+ _data.agents[agentId].socket[peerId].dataReceive = callback;
+ };
+
+ this.setSocketStatusListener = function (callback) {
+ var agentId = saSocket.peerAgent.agentId,
+ peerId = saSocket.peerAgent.peerId;
+
+ t.SASocket("setSocketStatusListener", arguments);
+
+ _data.agents[agentId].socket[peerId].socketStatus = callback;
+ };
+};
+
+event.on("wearableRemoteSocketDataSent", function (peerAgent, channelId, data) {
+ var agentId = peerAgent.agentId,
+ peerId = peerAgent.peerId;
+
+ if (_data.agents[agentId] && _data.agents[agentId].socket[peerId] &&
+ _data.agents[agentId].socket[peerId].dataReceive) {
+ channelId = _data.agents[agentId].channelIds[0];
+ _data.agents[agentId].socket[peerId].dataReceive(channelId, data);
+ }
+});
+
+SAFileTransfer = function (defaultReceivePath) {
+ var saFileTransfer = {};
+
+ saFileTransfer.defaultReceivePath = defaultReceivePath || "";
+
+ this.__defineGetter__("defaultReceivePath", function () {
+ return saFileTransfer.defaultReceivePath;
+ });
+
+ this.sendFile = function (peerAgent, filePath) {
+ t.SAFileTransfer("sendFile", arguments);
+
+ event.trigger("wearableFileTransfered", [peerAgent, filePath]);
+ };
+
+ this.setFileSendListener = function (callback) {
+ t.SAFileTransfer("setFileSendListener", arguments);
+
+ _data.saFileTransfer.fileSendListener = callback;
+ };
+
+ this.setFileReceiveListener = function (callback) {
+ t.SAFileTransfer("setFileReceiveListener", arguments);
+
+ _data.saFileTransfer.fileReceiveListener = callback;
+ };
+
+ this.receiveFile = function (id, localPath) {
+ t.SAFileTransfer("receiveFile", arguments);
+
+ if (_data.saFileTransfer.fileReceiveListener) {
+ if (_data.saFileTransfer.fileReceiveListener.oncomplete) {
+ _data.saFileTransfer.fileReceiveListener.oncomplete(id, localPath);
+ }
+ }
+ };
+
+ this.cancelFile = function (id) {
+ t.SAFileTransfer("cancelFile", arguments);
+
+ if (_data.saFileTransfer.fileReceiveListener) {
+ if (_data.saFileTransfer.fileReceiveListener.onerror) {
+ _data.saFileTransfer.fileReceiveListener.onerror(
+ new WebAPIError(errorcode.PEER_REJECTED), id);
+ }
+ }
+ };
+
+ this.rejectFile = function (id) {
+ t.SAFileTransfer("rejectFile", arguments);
+
+ if (_data.saFileTransfer.fileReceiveListener) {
+ if (_data.saFileTransfer.fileReceiveListener.onerror) {
+ _data.saFileTransfer.fileReceiveListener.onerror(
+ new WebAPIError(errorcode.PEER_REJECTED), id);
+ }
+ }
+ };
+};
+
+event.on("wearableFileTransferCompleted", function (id, localPath) {
+ if (_data.saFileTransfer.fileSendListener) {
+ if (_data.saFileTransfer.fileSendListener.oncomplete) {
+ _data.saFileTransfer.fileSendListener.oncomplete(id, localPath);
+ }
+ }
+});
+
+_initialize();
+
+module.exports = _self;
+
+});
+define('ripple/platform/wearable/2.0/spec/config', function (require, exports, module) {
+/*
+ * Copyright 2014 Research In Motion Limited.
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var utils = require('ripple/utils'),
+ db = require('ripple/db'),
+ constants = require('ripple/constants');
+
+module.exports = {
+ fileName: "config.xml",
+ validateVersion: function (configValidationObject) {
+ var valid = true;
+ // no xmlns:JIL in wac 2.0 spec
+ valid = !!configValidationObject.widget.validationResult[0].attributes.xmlns.valid;
+
+ return valid;
+ },
+ extractInfo: function (configValidationObject) {
+ if (!configValidationObject) {
+ return null;
+ }
+
+ var widgetInfo = {},
+ configFeatures,
+ configPreferences,
+ preferenceName,
+ platform, rst, i, j,
+ settingRst = {
+ 'screen-orientation': 'portrait',
+ 'context-menu': 'enable',
+ 'background-support': 'disable',
+ encryption: 'disable',
+ 'install-location': 'auto',
+ 'hwkey-event': 'enable'
+ };
+
+ widgetInfo.id = configValidationObject.widget.validationResult[0].attributes.id.value || "";
+ widgetInfo.name = configValidationObject.widget.children.name.validationResult[0].value;
+ widgetInfo.icon = configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;
+ widgetInfo.version = configValidationObject.widget.validationResult[0].attributes.version.value;
+ if (configValidationObject.widget.children.application.validationResult[0].valid) {
+ widgetInfo.tizenAppId = configValidationObject.widget.children.application.validationResult[0].attributes.id.value;
+ widgetInfo.tizenPackageId = configValidationObject.widget.children.application.validationResult[0].attributes.package.value;
+ }
+
+ widgetInfo.features = {};
+
+ if (configValidationObject.widget.children.setting.hasOwnProperty('validationResult') === true) {
+ rst = configValidationObject.widget.children.setting.validationResult;
+ // the first one has higher priority per platform implementation
+ for (i = rst.length -1 ; i >= 0; i--) {
+ if (rst[i].valid === true) {
+ for (j in rst[i].attributes) {
+ if (rst[i].attributes[j].value !== undefined) {
+ settingRst[j] = rst[i].attributes[j].value;
+ }
+ }
+ }
+ }
+ db.save("layout", settingRst["screen-orientation"]);
+ }
+
+ configFeatures = configValidationObject.widget.children.feature.validationResult;
+ utils.forEach(configFeatures, function (f) {
+ if (f.valid === true) {
+ var feature = {id: f.attributes.name.value,
+ required: f.attributes.required.valid};
+ widgetInfo.features[feature.id] = feature;
+ }
+ });
+
+ widgetInfo.metadata = {};
+ if (configValidationObject.widget.children.metadata.hasOwnProperty('validationResult') === true) {
+ widgetInfo.metadata.key = configValidationObject.widget.children.metadata.validationResult[0].attributes.key.value;
+ widgetInfo.metadata.value = configValidationObject.widget.children.metadata.validationResult[0].attributes.value.value;
+ }
+
+ widgetInfo.category = {};
+ if (configValidationObject.widget.children.category.hasOwnProperty('validationResult') === true) {
+ widgetInfo.metadata.name = configValidationObject.widget.children.category.validationResult[0].attributes.name.value;
+ }
+
+ widgetInfo.preferences = {};
+
+ configPreferences = configValidationObject.widget.children.preference.validationResult;
+
+ platform = require('ripple/platform');
+ utils.forEach(configPreferences, function (preference) {
+ preferenceName = preference.attributes.name.value;
+ if (preferenceName) {
+ widgetInfo.preferences[preferenceName] = {
+ "key": preferenceName,
+ "value": preference.attributes.value.value || "",
+ "readonly": preference.attributes.readonly.value === "true"
+ };
+
+ db.save(preferenceName,
+ widgetInfo.preferences[preferenceName].value,
+ platform.getPersistencePrefix(widgetInfo.id));
+ }
+ });
+
+ return widgetInfo;
+ },
+ schema: {
+ rootElement: "widget",
+ widget: {
+ nodeName: "widget",
+ required: true,
+ occurrence: 1,
+ helpText: "\"widget\" element describes widget information in configuration documents and serves as a container for other elements. It must be used in the configuration document and may have the following child elments: name,description,icon,author,license,content,feature and preference.The \"widget\" element MAY have following attributes: id,version,height,width, defaultlocale, xml:lang and dir",
+ attributes: {
+ xmlns: {
+ attributeName: "xmlns",
+ required: true,
+ type: "list",
+ listValues: ["http://www.w3.org/ns/widgets"]
+ },
+ "xmlns:tizen": {
+ attributeName: "xmlns:tizen",
+ required: false,
+ type: "list",
+ listValues: ["http://tizen.org/ns/widgets"]
+ },
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ id: {
+ attributeName: "id",
+ required: false,
+ type: "string"
+ },
+ version: {
+ attributeName: "version",
+ required: false,
+ type: "string"
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ },
+ viewmodes: {
+ attributeName: "viewmodes",
+ required: false,
+ type: "list",
+ listValues: ["windowed", "floating", "fullscreen", "maximized", "minimized"]
+ },
+ defaultlocale: {
+ attributeName: "defaultlocale",
+ required: false,
+ type: "iso-language"
+ }
+ },
+ children: {
+ name: {
+ nodeName: "name",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ "short": {
+ attributeName: "short",
+ required: false,
+ type: "string"
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ description: {
+ nodeName: "description",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ author: {
+ nodeName: "author",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ href: {
+ attributeName: "href",
+ required: false,
+ type: "regex",
+ regex: constants.REGEX.URL
+ },
+ email: {
+ attributeName: "email",
+ required: false,
+ type: "regex",
+ regex: constants.REGEX.EMAIL
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ license: {
+ nodeName: "license",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ href: {
+ attributeName: "href",
+ type: "regex",
+ required: false,
+ regex: constants.REGEX.URL
+ }
+ },
+ children: {
+ span: {
+ nodeName: "span",
+ required: false,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ }
+ }
+ }
+ }
+ },
+ icon: {
+ nodeName: "icon",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ }
+ }
+ },
+ content: {
+ nodeName: "content",
+ required: false,
+ occurrence: 1,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language",
+ unique: true
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ encoding: {
+ attributeName: "encoding",
+ required: false,
+ type: "string"
+ },
+ type: {
+ attributeName: "type",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ setting: {
+ nodeName: "tizen:setting",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ 'screen-orientation': {
+ attributeName: "screen-orientation",
+ required: false,
+ type: "list",
+ listValues: ['portrait', 'landscape', 'auto']
+ },
+ 'context-menu': {
+ attributeName: "context-menu",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'background-support': {
+ attributeName: "background-support",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'encryption': {
+ attributeName: "encryption",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ },
+ 'install-location': {
+ attributeName: "install-location",
+ required: false,
+ type: "list",
+ listValues: ['auto', 'internal-only', 'perfer-external']
+ },
+ 'hwkey-event': {
+ attributeName: "hwkey-event",
+ required: false,
+ type: "list",
+ listValues: ['enable', 'disable']
+ }
+ }
+ },
+ application: {
+ nodeName: "tizen:application",
+ required: true,
+ occurrence: 1,
+ attributes: {
+ id: {
+ attributeName: "id",
+ required: true,
+ type: "string"
+ },
+ required_version: {
+ attributeName: "required_version",
+ required: true,
+ type: "list",
+ listValues: ['1.0', '2.0', '2.1', '2.2']
+ },
+ package: {
+ attributeName: "package",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ "tizen:content": {
+ nodeName: "tizen:content",
+ required: false,
+ occurrence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ control: {
+ nodeName: "tizen:app-control",
+ required: false,
+ occurrence: 0,
+ children: {
+ src: {
+ nodeName: "tizen:src",
+ required: true,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ operation: {
+ nodeName: "tizen:operation",
+ required: true,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ uri: {
+ nodeName: "tizen:uri",
+ required: false,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ mime: {
+ nodeName: "tizen:mime",
+ required: false,
+ occurence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ required: false,
+ type: "string"
+ }
+ }
+ }
+ }
+ },
+ "app-widget": {
+ nodeName: "tizen:app-widget",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ id: {
+ attributeName: "id",
+ required: true,
+ type: "string"
+ },
+ primary: {
+ attributeName: "primary",
+ required: true,
+ type: "list",
+ listValues: ['true', 'false']
+ },
+ "auto-launch": {
+ attributeName: "auto-launch",
+ required: false,
+ type: "list",
+ listValues: ['true', 'false']
+ },
+ "update-period": {
+ attributeName: "update-period",
+ required: false,
+ type: "integer"
+ }
+ },
+ children: {
+ "box-label": {
+ nodeName: "tizen:box-label",
+ required: true,
+ occurence: 1
+ },
+ "box-icon": {
+ nodeName: "tizen:box-icon",
+ required: true,
+ occurence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ "box-content": {
+ nodeName: "tizen:box-content",
+ required: true,
+ occurence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ "mouse-event": {
+ attributeName: "mouse-event",
+ required: false,
+ type: "string"
+ },
+ "touch-event": {
+ attributeName: "touch-event",
+ required: false,
+ type: "string"
+ }
+ },
+ children: {
+ "box-size": {
+ nodeName: "tizen:box-size",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "preview": {
+ attributeName: "preview",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ pd: {
+ nodeName: "tizen:pd",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "src": {
+ attributeName: "src",
+ required: true,
+ type: "string"
+ },
+ "width": {
+ attributeName: "width",
+ required: true,
+ type: "integer"
+ },
+ "height": {
+ attributeName: "height",
+ required: true,
+ type: "integer"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ account: {
+ nodeName: "tizen:account",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "multiple-account-support": {
+ attributeName: "multiple-account-support",
+ required: true,
+ type: "list",
+ listValues: ['true', 'false']
+ }
+ },
+ children: {
+ icon: {
+ nodeName: "tizen:icon",
+ required: false,
+ occurence: 1,
+ attributes: {
+ section: {
+ attributeName: "section",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ "display-name": {
+ nodeName: "tizen:display-name",
+ required: false,
+ occurence: 1,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "string"
+ }
+ }
+ },
+ capability: {
+ nodeName: "capability",
+ required: false,
+ occurence: 1
+ }
+ }
+ },
+ feature: {
+ nodeName: "tizen:privilege",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "list",
+ listValues: ["http://developer.samsung.com/privilege/accessoryprotocol",
+ "http://developer.samsung.com/privilege/healthinfo",
+ "http://developer.samsung.com/privilege/irled",
+ "http://www.w3.org/TR/battery-status/",
+ "http://www.w3.org/TR/geolocation-API/",
+ "http://www.w3.org/TR/touch-events/",
+ "http://www.w3.org/TR/vibration/",
+ "http://tizen.org/privilege/tizen",
+ "http://tizen.org/privilege/alarm",
+ "http://tizen.org/privilege/application.launch",
+ "http://tizen.org/privilege/appmanager.kill", "http://tizen.org/privilege/appmanager.certificate",
+ "http://tizen.org/privilege/content.read", "http://tizen.org/privilege/content.write",
+ "http://tizen.org/privilege/filesystem.read", "http://tizen.org/privilege/filesystem.write",
+ "http://tizen.org/privilege/packagemanager.install", "http://tizen.org/privilege/package.info",
+ "http://tizen.org/privilege/power",
+ "http://tizen.org/privilege/system", "http://tizen.org/privilege/systemmanager",
+ "http://tizen.org/privilege/time"]
+ },
+ required: {
+ attributeName: "required",
+ type: "boolean",
+ required: false
+ }
+ },
+ children: {
+ param: {
+ nodeName: "param",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "string"
+ },
+ value: {
+ attributeName: "value",
+ required: true,
+ type: "string"
+ }
+ }
+ }
+ }
+ },
+ category: {
+ nodeName: "tizen:category",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "name": {
+ attributeName: "name",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ metadata: {
+ nodeName: "tizen:metadata",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "key": {
+ attributeName: "key",
+ required: true,
+ type: "string"
+ },
+ "value": {
+ attributeName: "value",
+ required: true,
+ type: "string"
+ }
+ }
+ },
+ preference: {
+ nodeName: "preference",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ name: {
+ attributeName: "name",
+ required: true,
+ type: "string"
+ },
+ value: {
+ type: "string",
+ required: false,
+ attributeName: "value"
+ },
+ readonly: {
+ attributeName: "readonly",
+ type: "boolean",
+ required: false
+ }
+ }
+ }
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/wearable/2.0/spec/device', function (require, exports, module) {
+/*
+ * Copyright 2011 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var event = require('ripple/event'),
+ utils = require('ripple/utils'),
+ StorageTypeTable = {
+ "UNKNOWN": "UNKNOWN",
+ "INTERNAL": "INTERNAL",
+ "MMC": "MMC",
+ "USB_HOST": "USB_HOST"
+ },
+ NetworkTypeTable = {
+ "NONE": "NONE",
+ "2G": "2G",
+ "2.5G": "2.5G",
+ "3G": "3G",
+ "4G": "4G",
+ "WIFI": "WIFI",
+ "ETHERNET": "ETHERNET",
+ "UNKNOWN": "UNKNOWN"
+ },
+ LocaleTable = {
+ "eng_USA": "eng_USA",
+ "eng_CAN": "eng_CAN",
+ "deu_DEU": "deu_DEU",
+ "jpn_JPN": "jpn_JPN",
+ "zho_CHN": "zho_CHN",
+ "UNKNOWN": "UNKNOWN"
+ },
+ SimStateTable = {
+ "ABSENT": "ABSENT",
+ "INITIALIZING": "INITIALIZING",
+ "READY": "READY",
+ "PIN_REQUIRED": "PIN_REQUIRED",
+ "PUK_REQUIRED":"PUK_REQUIRED",
+ "NETWORK_LOCKED": "NETWORK_LOCKED",
+ "SIM_LOCKED": "SIM_LOCKED",
+ "UNKNOWN": "UNKNOWN"
+ };
+
+function deviceStatusEventTrigger(setting) {
+ event.trigger("DeviceStatusChanged", [setting]);
+}
+
+module.exports = {
+ "Config": {
+ "vibratingMode": {
+ "name": "Vibrator",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ },
+ "callback": function (setting) {
+ event.trigger("VibratingModeChanged", [setting]);
+ }
+ },
+ "lockScreen": {
+ "name": "Lock Screen",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "callback": function (setting) {
+ event.trigger("LockScreenChanged", [setting]);
+ }
+ }
+ },
+ "DEVICE_ORIENTATION": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "label",
+ "innertext": "PORTRAIT_PRIMARY",
+ "value": "PORTRAIT_PRIMARY"
+ },
+ "event": "LayoutChanged"
+ },
+ "isAutoRotation": {
+ "name": "Is Auto Rotation",
+ "control": {
+ "type": "label",
+ "value": false
+ }
+ }
+ },
+ "CPU": {
+ "load": {
+ "name": "Load",
+ "control": {
+ "type": "number",
+ "value": 0.1
+ },
+ "event": "CpuLoadChanged",
+ "callback": function (setting) {
+ if (setting > 1) setting = 1;
+ if (setting < 0) setting = 0;
+ event.trigger("CpuLoadChanged", [setting]);
+ }
+ }
+ },
+ "STORAGE": {
+ "type": {
+ "name": "Type",
+ "control": {
+ "type": "select",
+ "value": StorageTypeTable["INTERNAL"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(StorageTypeTable, function (key, value) {
+ optionList[key] = StorageTypeTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "capacity": {
+ "name": "Capacity(bytes)",
+ "control": {
+ "type": "label",
+ "value": 16000000000
+ }
+ },
+ "availableCapacity": {
+ "name": "AvailableCapacity(bytes)",
+ "control": {
+ "type": "number",
+ "value": 12000000000
+ },
+ "callback": function (setting) {
+ event.trigger("AvailCapacityChanged", [setting]);
+ }
+ },
+ "isRemovable": {
+ "name": "IsRemovable",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ }
+ }
+ },
+ "BUILD": {
+ "model": {
+ "name": "Model",
+ "control": {
+ "type": "label",
+ "innertext": "tizen-2.2 build",
+ "value": "tizen-2.2 build"
+ }
+ },
+ "manufacturer": {
+ "name": "Manufacturer",
+ "control": {
+ "type": "label",
+ "innertext": "Tizen",
+ "value": "Tizen"
+ }
+ },
+ "buildVersion": {
+ "name": "Build Version",
+ "control": {
+ "type": "label",
+ "innertext": "TIZEN_WEB_SIMULATOR_000001",
+ "value": "TIZEN_WEB_SIMULATOR_000001"
+ }
+ }
+ },
+ "LOCALE": {
+ "language": {
+ "name": "Language",
+ "control": {
+ "type": "select",
+ "value": LocaleTable["eng_USA"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(LocaleTable, function (key, value) {
+ optionList[key] = LocaleTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "country": {
+ "name": "Country",
+ "control": {
+ "type": "select",
+ "value": LocaleTable["eng_USA"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(LocaleTable, function (key, value) {
+ optionList[key] = LocaleTable[value];
+ });
+
+ return optionList;
+ }())
+ }
+ },
+ "DISPLAY": {
+ "resolutionWidth": {
+ "name": "Resolution Width(pixels)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "resolutionHeight": {
+ "name": "Resolution Height(pixels)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "dotsPerInchWidth": {
+ "name": "DPI-X",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "dotsPerInchHeight": {
+ "name": "DPI-Y",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "physicalWidth": {
+ "name": "Physical Width(millimeters)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "physicalHeight": {
+ "name": "Physical Height(millimeters)",
+ "control": {
+ "type": "label",
+ "value": 0
+ }
+ },
+ "brightness": {
+ "name": "Brightness",
+ "control": {
+ "type": "number",
+ "value": 1
+ },
+ "event": "DisplayBrightnessChanged",
+ "callback": function (setting) {
+ if (setting > 1) setting = 1;
+ if (setting < 0) setting = 0;
+ event.trigger("DisplayBrightnessChanged", [setting]);
+ }
+ }
+ },
+ "NETWORK": {
+ "networkType": {
+ "name": "Network Type",
+ "control" : {
+ "type": "select",
+ "value": NetworkTypeTable["NONE"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(NetworkTypeTable, function (key, value) {
+ optionList[key] = NetworkTypeTable[value];
+ });
+
+ return optionList;
+ }())
+ }
+ },
+ "WIFI_NETWORK": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "event": "WiFiNetworkStatusChanged",
+ "callback": function (setting) {
+ event.trigger("WiFiNetworkStatusChanged", [setting]);
+ }
+ },
+ "ssid": {
+ "name": "SSID",
+ "control": {
+ "type": "text",
+ "value": "Tizen WiFi"
+ }
+ },
+ "ipAddress": {
+ "name": "IP Address",
+ "control": {
+ "type": "text",
+ "value": "192.168.0.1"
+ }
+ },
+ "ipv6Address": {
+ "name": "IPv6 Address",
+ "control": {
+ "type": "text",
+ "value": "2001:db8:85a3:0:0:0:70:7334"
+ }
+ },
+ "signalStrength": {
+ "name": "Signal Strength",
+ "control": {
+ "type": "select",
+ "value": 0
+ },
+ "options": (function () {
+ var i,
+ optionList = {};
+
+ for (i = 0; i <= 10; i++) {
+ optionList[i] = i;
+ }
+
+ return optionList;
+ }())
+ }
+ },
+ "CELLULAR_NETWORK": {
+ "status": {
+ "name": "Status",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ },
+ "event": "CellularNetworkStatusChanged",
+ "callback": function (setting) {
+ event.trigger("CellularNetworkStatusChanged", [setting]);
+ }
+ },
+ "apn": {
+ "name": "APN",
+ "control": {
+ "type": "text",
+ "value": "Tizen"
+ }
+ },
+ "ipAddress": {
+ "name": "IP Address",
+ "control": {
+ "type": "text",
+ "value": "10.0.2.16"
+ }
+ },
+ "ipv6Address": {
+ "name": "IPv6 Address",
+ "control": {
+ "type": "text",
+ "value": "2001:db8:85a3:0:0:0:70:7334"
+ }
+ },
+ "mcc": {
+ "name": "MCC",
+ "control": {
+ "type": "number",
+ "value": 460
+ }
+ },
+ "mnc": {
+ "name": "MNC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "cellId": {
+ "name": "Cell ID",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "lac": {
+ "name": "LAC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "isRoaming": {
+ "name": "Roaming",
+ "control": {
+ "type": "checkbox",
+ "value": true
+ }
+ },
+ "isFlightMode": {
+ "name": "Flight Mode",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ },
+ "callback": function (setting) {
+ event.trigger("FlightModeChanged", [setting]);
+ }
+ },
+ "imei": {
+ "name": "IMEI",
+ "control": {
+ "type": "text",
+ "value": "012417005203000"
+ }
+ }
+ },
+ "SIM": {
+ "state": {
+ "name": "State",
+ "control": {
+ "type": "select",
+ "value": SimStateTable["READY"]
+ },
+ "options": (function () {
+ var optionList = {};
+ utils.forEach(SimStateTable, function (key, value) {
+ optionList[key] = SimStateTable[value];
+ });
+
+ return optionList;
+ }())
+ },
+ "operatorName": {
+ "name": "Operator Name",
+ "control": {
+ "type": "text",
+ "value": "Tizen"
+ }
+ },
+ "msisdn": {
+ "name": "MSISDN",
+ "control": {
+ "type": "text",
+ "value": "088123456789"
+ }
+ },
+ "iccid": {
+ "name": "ICCID",
+ "control": {
+ "type": "text",
+ "value": "123000MFSSYYGXXXXXXP"
+ }
+ },
+ "mcc": {
+ "name": "MCC",
+ "control": {
+ "type": "number",
+ "value": 460
+ }
+ },
+ "mnc": {
+ "name": "MNC",
+ "control": {
+ "type": "number",
+ "value": 0
+ }
+ },
+ "msin": {
+ "name": "MSIN",
+ "control": {
+ "type": "text",
+ "value": "H1 H2 H3 S 12345"
+ }
+ },
+ "spn": {
+ "name": "SPN",
+ "control": {
+ "type": "text",
+ "value": "TizenSPN"
+ }
+ }
+ },
+ "PERIPHERAL": {
+ "isVideoOutputOn": {
+ "name": "Video Output",
+ "control": {
+ "type": "checkbox",
+ "value": false
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/wearable/2.0/spec/sensor', function (require, exports, module) {
+/*
+ * Copyright 2012 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var event = require('ripple/event');
+
+function sensorStatusEventTrigger(setting) {
+ event.trigger("SensorStatusChanged", [setting]);
+}
+
+module.exports = {
+ "Accelerometer": {
+ "resolution": 0.039239998906850815,
+ "minDelay": 20,
+ "range": 20.051639556884766,
+ "name": "Accelerometer",
+ "type": "Accelerometer"
+ },
+ "MagneticField": {
+ "x": {
+ "name": "X",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-xChanged", [setting]);
+ }
+ },
+
+ "y": {
+ "name": "Y",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-yChanged", [setting]);
+ }
+ },
+
+ "z": {
+ "name": "Z",
+ "control": {
+ "type": "range",
+ "value": 100.0000000000000000,
+ "min": 0.0000000000000000,
+ "max": 200.0000000000000000,
+ "step": 0.0000000000000001
+ },
+ "callback": function (setting) {
+ event.trigger("MagneticField-zChanged", [setting]);
+ }
+ },
+
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "MagneticField",
+ "type": "MagneticField"
+ },
+ "Rotation": {
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "Rotation",
+ "type": "Rotation"
+ },
+ "Orientation": {
+ "resolution": 1,
+ "minDelay": 20,
+ "range": 359,
+ "name": "Orientation",
+ "type": "Orientation"
+ }
+};
+
+});
+define('ripple/platform/wearable/2.0/spec/ui', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module.exports = {
+ plugins: [
+ "sensors",
+ "geoView",
+ "widgetConfig",
+ "deviceSettings",
+ "application",
+ "power",
+ "package",
+ "sap",
+ "motion",
+ "irled"
+ ]
+};
+
+});
+define('ripple/platform/wearable/2.0/spec', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = {
+
+ id: "wearable",
+ version: "2.0",
+ name: "WEARABLE",
+
+ persistencePrefix: "wearable2-",
+
+ config: require('ripple/platform/wearable/2.0/spec/config'),
+ ui: require('ripple/platform/wearable/2.0/spec/ui'),
+ device: require('ripple/platform/wearable/2.0/spec/device'),
+ sensor: require('ripple/platform/wearable/2.0/spec/sensor'),
+ DeviceMotionEvent: require('ripple/platform/tizen/2.0/DeviceMotionEvent'),
+ DeviceOrientationEvent: require('ripple/platform/tizen/2.0/DeviceOrientationEvent'),
+
+ objects: {
+ Coordinates: {
+ path: "w3c/1.0/Coordinates"
+ },
+ Position: {
+ path: "w3c/1.0/Position"
+ },
+ PositionError: {
+ path: "w3c/1.0/PositionError"
+ },
+ SensorConnection: {
+ path: "w3c/1.0/SensorConnection"
+ },
+ navigator: {
+ path: "tizen/2.0/navigator",
+ children: {
+ geolocation: {
+ path: "wac/2.0/geolocation"
+ },
+ battery: {
+ path: "tizen/2.0/battery"
+ }
+ }
+ },
+ tizen: {
+ feature: "http://tizen.org/privilege/tizen",
+ children: {
+ AlarmAbsolute: {
+ path: "tizen/2.0/AlarmAbsolute"
+ },
+ AlarmRelative: {
+ path: "tizen/2.0/AlarmRelative"
+ },
+ ApplicationControl: {
+ path: "tizen/2.0/ApplicationControl"
+ },
+ ApplicationControlData: {
+ path: "tizen/2.0/ApplicationControlData"
+ },
+ AttributeFilter: {
+ path: "tizen/2.0/AttributeFilter"
+ },
+ AttributeRangeFilter: {
+ path: "tizen/2.0/AttributeRangeFilter"
+ },
+ TZDate: {
+ path: "tizen/2.0/TZDate"
+ },
+ TimeDuration: {
+ path: "tizen/2.0/TimeDuration"
+ },
+ alarm: {
+ path: "tizen/2.0/alarm",
+ feature: "http://tizen.org/privilege/alarm",
+ handleSubfeatures: true
+ },
+ application: {
+ path: "tizen/2.0/application",
+ feature: "http://tizen.org/privilege/application.launch|http://tizen.org/privilege/appmanager.kill|http://tizen.org/privilege/appmanager.certificate",
+ handleSubfeatures: true
+ },
+ content: {
+ path: "tizen/2.0/content",
+ feature: "http://tizen.org/privilege/content.read|http://tizen.org/privilege/content.write",
+ handleSubfeatures: true
+ },
+ filesystem: {
+ path: "tizen/2.0/filesystem",
+ feature: "http://tizen.org/privilege/filesystem.read|http://tizen.org/privilege/filesystem.write"
+ },
+ package: {
+ path: "tizen/2.0/package",
+ feature: "http://tizen.org/privilege/packagemanager.install|http://tizen.org/privilege/package.info",
+ handleSubfeatures: true
+ },
+ power: {
+ path: "tizen/2.0/power",
+ feature: "http://tizen.org/privilege/power",
+ handleSubfeatures: true
+ },
+ systeminfo: {
+ path: "tizen/2.0/systeminfo",
+ feature: "http://tizen.org/privilege/system|http://tizen.org/privilege/systemmanager",
+ handleSubfeatures: true
+ },
+ time: {
+ path: "tizen/2.0/time",
+ feature: "http://tizen.org/privilege/time",
+ handleSubfeatures: true
+ }
+ }
+ },
+ webapis: {
+ children: {
+ irled: {
+ path: "wearable/2.0/irled",
+ feature: "http://developer.samsung.com/privilege/irled",
+ handleSubfeatures: true
+ },
+ motion: {
+ path: "wearable/2.0/motion",
+ feature: "http://developer.samsung.com/privilege/healthinfo",
+ handleSubfeatures: true
+ },
+ sa: {
+ path: "wearable/2.0/sa",
+ feature: "http://developer.samsung.com/privilege/accessoryprotocol",
+ handleSubfeatures: true
+ }
+ }
+ }
+ }
+};
+
+});
+define('ripple/platform/wearable/2.0/typecast', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var typedef = require('ripple/platform/wearable/2.0/typedef'),
+ errorcode = require('ripple/platform/wearable/2.0/errorcode'),
+ WebAPIException = require('ripple/platform/wearable/2.0/WebAPIException'),
+ TypeCoerce = require('ripple/platform/wearable/2.0/typecoerce'),
+ _self = {};
+
+function _cast(pattern, obj, isDuplicate) {
+ var tc, tcFunc;
+
+ if (pattern === null)
+ return;
+
+ tc = new TypeCoerce(pattern);
+ tcFunc = isDuplicate ? tc.copy : tc.cast;
+
+ if ((obj = tcFunc(obj)) === null) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ return obj;
+}
+
+function _castType(pattern) {
+ /*
+ * Type cast for each known type. The function name is the exact name of the
+ * corresponding type.
+ *
+ * obj
+ * Variable to be casted
+ *
+ * aux
+ * Auxiliary descriptor of obj. It can be any one or combination of below
+ * strings, or ignored in most cases.
+ *
+ * "?" Nullable types
+ * "[]" Array
+ * "+" Deep copy
+ *
+ * Return
+ * Casted or duplicated object.
+ */
+
+ return function (obj, aux) {
+ var type, isNullable, isDuplicate;
+
+ aux = aux ? String(aux) : "";
+ type = (aux.indexOf("[]") !== -1) ? [pattern] : pattern;
+ isNullable = (aux.indexOf("?") !== -1);
+ isDuplicate = (aux.indexOf("+") !== -1);
+
+ if (isNullable && ((obj === null) || (obj === undefined))) {
+ return obj;
+ }
+
+ return _cast(type, obj, isDuplicate);
+ };
+}
+
+function _castConstructor(name) {
+ var constructors, hook, vtc, isOverloaded, castConstructor;
+
+ /*
+ * Type cast for constructor. The function name is the exact name of the
+ * object type.
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ */
+
+ function castUnique(argv) {
+ _cast(constructors, argv, false);
+ }
+
+ /*
+ * Type cast for overloaded constructors. The function name is the exact
+ * name of the object type.
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ *
+ * scope
+ * 'this' of the original constructor.
+ *
+ * voc
+ * Array of overloaded constructors callback
+ */
+
+ function castOverload(argv, scope, voc) {
+ var iOverload;
+
+ if (!vtc) {
+ vtc = [];
+ constructors.forEach(function (c) {
+ vtc.push((c === null) ? null : new TypeCoerce(c));
+ });
+ }
+
+ vtc.some(function (tc, index) {
+ if (tc && (tc.cast(argv) === null))
+ return false;
+
+ iOverload = index;
+ return true;
+ });
+
+ if (iOverload === undefined) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR);
+ }
+
+ return (voc && voc[iOverload].apply(scope, argv));
+ }
+
+ constructors = typedef.constructor[name];
+
+ if (name in _self) {
+ hook = _self[name];
+ }
+
+ isOverloaded = (Object.prototype.toString.call(constructors) ===
+ "[object Array]");
+ castConstructor = isOverloaded ? castOverload : castUnique;
+
+ return function (argv, scope) {
+ if (Object.prototype.toString.call(argv) !== "[object Arguments]") {
+ return (hook && hook.apply(this, arguments));
+ }
+
+ if (!(scope instanceof argv.callee)) {
+ throw new WebAPIException(errorcode.TYPE_MISMATCH_ERR, null, "TypeError");
+ }
+
+ castConstructor.apply(this, arguments);
+ };
+}
+
+function _castInterface(name) {
+ var interface, hook;
+
+ interface = typedef.interface[name];
+
+ if (name in _self) {
+ hook = _self[name];
+ }
+
+ /*
+ * Type cast for each known method of interface. The function name is the
+ * exact name of the corresponding interface.
+ *
+ * method
+ * String of method name
+ *
+ * argv
+ * arguments. The keyword 'arguments' will always be passed in.
+ *
+ * isDuplicate
+ * A boolean value to indicate whether arguments will be copied or not.
+ */
+
+ return function (method, argv, isDuplicate) {
+ if ((typeof method !== "string") || (typeof argv !== "object")) {
+ return (hook && hook.apply(this, arguments));
+ }
+
+ _cast(interface[method], argv, isDuplicate);
+ };
+}
+
+(function () {
+ var i;
+
+ for (i in typedef) {
+ _self[i] = _castType(typedef[i]);
+ }
+
+ for (i in typedef.constructor) {
+ _self[i] = _castConstructor(i);
+ typedef[i]._constructor = i;
+ }
+
+ for (i in typedef.interface) {
+ _self[i] = _castInterface(i);
+ }
+}());
+
+module.exports = _self;
+
+});
+define('ripple/platform/wearable/2.0/typecoerce', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var t = require('ripple/platform/wearable/2.0/typedef'),
+ _MAX_INT_BITS = 53,
+ _MAX_INT = Math.pow(2, _MAX_INT_BITS) - 1,
+ _self;
+
+_self = function (pattern) {
+ var typeCoerce, typeOfPattern;
+
+ // private
+ function getExtendedType(val) {
+ var type = Object.prototype.toString.call(val), attr;
+
+ switch (type) {
+ case "[object Array]":
+ if ((typeof val[0] === "string") && (val[0].length > 0)) {
+ type = "enum";
+ } else {
+ type = "Union";
+ }
+ return type;
+
+ case "[object Object]":
+ if ("_dictionary" in val) {
+ return "dictionary";
+ }
+
+ type = "Object";
+
+ for (attr in val) {
+ if (attr === "0") {
+ type = "Arguments";
+ } else if (val[attr] === "Callback") {
+ type = "Callback";
+ }
+ break;
+ }
+
+ return type;
+ }
+
+ switch (val) {
+ case "Callback":
+ type = "Function";
+ break;
+
+ case "TZDate":
+ case "any":
+ case "byte":
+ case "float":
+ case "long":
+ case "long long":
+ case "octet":
+ case "short":
+ case "unsigned long":
+ case "unsigned long long":
+ case "unsigned short":
+ type = val;
+ break;
+
+ case "double":
+ type = "float";
+ break;
+
+ default: // Derivative type name: e.g., "AbstractFilter"
+ type = "";
+ break;
+ }
+
+ return type;
+ }
+
+ function getType(val, isPattern) {
+ var type = Object.prototype.toString.call(val);
+
+ switch (type) {
+ case "[object Array]":
+ type = (isPattern && (val.length > 1)) ? getExtendedType(val) :
+ "Array";
+ break;
+
+ case "[object Arguments]":
+ type = "Arguments";
+ break;
+
+ case "[object Boolean]":
+ type = "boolean";
+ break;
+
+ case "[object Date]":
+ type = "Date";
+ break;
+
+ case "[object Function]":
+ type = "Function";
+ break;
+
+ case "[object Number]":
+ type = "Number";
+ break;
+
+ case "[object Object]":
+ type = isPattern ? getExtendedType(val) : "Object";
+ break;
+
+ case "[object String]":
+ type = (isPattern && !!val) ? getExtendedType(val) : "DOMString";
+ break;
+ }
+
+ return type;
+ }
+
+ function isConstructed(obj) {
+ if (!("_constructor" in pattern))
+ return true;
+
+ if (obj instanceof window.tizen[pattern._constructor])
+ return true;
+
+ if ("_derived" in pattern)
+ return true;
+
+ return false;
+ }
+
+ function toInteger(x) {
+ return (x < 0) ? Math.ceil(x) : Math.floor(x);
+ }
+
+ function isBitsOverflowed(bits) {
+ return (bits >= _MAX_INT_BITS);
+ }
+
+ function toJsInt(x, isUnsigned) {
+ var min, max;
+
+ min = isUnsigned ? 0 : -_MAX_INT;
+ max = _MAX_INT;
+
+ if ((x < min) || (x > max))
+ return null;
+
+ return toInteger(x);
+ }
+
+ function modulo(a, b) {
+ return (a - Math.floor(a / b) * b);
+ }
+
+ function toInt(x, bits) {
+ var p;
+
+ x = Number(x);
+
+ if (isNaN(x) || !isFinite(x))
+ return null;
+
+ if (isBitsOverflowed(bits))
+ return toJsInt(x, false);
+
+ p = Math.pow(2, bits);
+ x = modulo(toInteger(x), p);
+
+ return (x >= Math.pow(2, bits - 1)) ? (x - p) : x;
+ }
+
+ function toUInt(x, bits) {
+ x = Number(x);
+
+ if (isNaN(x) || !isFinite(x))
+ return null;
+
+ if (isBitsOverflowed(bits))
+ return toJsInt(x, true);
+
+ return modulo(toInteger(x), Math.pow(2, bits));
+ }
+
+ function toInt8(x) {
+ return toInt(x, 8);
+ }
+
+ function toInt16(x) {
+ return toInt(x, 16);
+ }
+
+ function toInt32(x) {
+ return toInt(x, 32);
+ }
+
+ function toInt64(x) {
+ return toInt(x, 64);
+ }
+
+ function toUInt8(x) {
+ return toUInt(x, 8);
+ }
+
+ function toUInt16(x) {
+ return toUInt(x, 16);
+ }
+
+ function toUInt32(x) {
+ return toUInt(x, 32);
+ }
+
+ function toUInt64(x) {
+ return toUInt(x, 64);
+ }
+
+ // public
+ function cast(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Arguments": function () {
+ var i, isNullable, ret;
+
+ for (i in pattern) {
+ if (i === "_optional")
+ continue;
+
+ isNullable = !!(pattern._optional && pattern._optional[i]);
+
+ if (i > obj.length - 1) {
+ if (!isNullable) {
+ return null;
+ }
+ break;
+ }
+
+ if (!isNullable || (obj[i] !== null)) {
+ ret = _self(pattern[i]).cast(obj[i]);
+ if (ret === null) {
+ return null;
+ }
+ obj[i] = ret;
+ }
+ }
+
+ return obj;
+ },
+
+ "Array": function () {
+ var elementType, i, ret;
+
+ if (typeOfObj !== typeOfPattern) {
+ return null;
+ }
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ ret = elementType.cast(obj[i]);
+ if (ret === null) {
+ return null;
+ }
+ obj[i] = ret;
+ }
+
+ return obj;
+ },
+
+ "Callback": function () {
+ var attr;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ obj[attr] = _self(pattern[attr]).cast(obj[attr]);
+ if (obj[attr] === null) {
+ return null;
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ "DOMString": function () {
+ switch (typeOfObj) {
+ case "DOMString":
+ case "Date":
+ case "Number":
+ case "boolean":
+ obj = String(obj);
+ break;
+
+ default:
+ if ((obj === null) || (obj === undefined)) {
+ obj = String(obj);
+ } else {
+ obj = null;
+ }
+ break;
+ }
+
+ return obj;
+ },
+
+ "Date": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "Function": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "Object": function () {
+ var ret, attr, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return null;
+ }
+ if (!("_derived" in pattern)) {
+ return null;
+ }
+ }
+
+ if (!isConstructed(obj)) {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ ret = _self(pattern._derived[i]).cast(obj);
+ if (ret !== null)
+ break;
+ }
+ if (ret === null) {
+ if ("_constructor" in pattern)
+ break;
+
+ return null;
+ }
+ break;
+
+ default:
+ if (!pattern._optional || !pattern._optional[attr] ||
+ (obj[attr] !== undefined) &&
+ (obj[attr] !== null)) {
+ ret = _self(pattern[attr]).cast(obj[attr]);
+ if (ret === null) {
+ return null;
+ }
+ obj[attr] = ret;
+ }
+ break;
+ }
+ }
+
+ return obj;
+ },
+
+ "TZDate": function () {
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+ return (obj instanceof window.tizen.TZDate) ? obj : null;
+ },
+
+ "Union": function () {
+ var ret, i;
+
+ for (i in pattern) {
+ ret = _self(pattern[i]).cast(obj);
+ if (ret !== null)
+ break;
+ }
+
+ return ret;
+ },
+
+ "any": function () {
+ return obj;
+ },
+
+ "boolean": function () {
+ return (typeOfObj === typeOfPattern) ? obj : null;
+ },
+
+ "byte": function () {
+ return toInt8(obj);
+ },
+
+ "dictionary": function () {
+ var attr, ret;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ ret = _self(pattern._dictionary).cast(obj);
+ if (ret === null) {
+ return null;
+ }
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret = _self(pattern[attr]).cast(obj[attr]);
+ if (ret === null) {
+ return null;
+ }
+ obj[attr] = ret;
+ }
+ break;
+ }
+ }
+
+ return obj;
+ },
+
+ "enum": function () {
+ var i;
+
+ obj = String(obj).trim();
+ for (i in pattern) {
+ if (obj === pattern[i]) {
+ return obj;
+ }
+ }
+
+ return null;
+ },
+
+ "float": function () {
+ var f = parseFloat(obj, 10);
+
+ return (isNaN(f) ? null : f);
+ },
+
+ "long": function () {
+ return toInt32(obj);
+ },
+
+ "long long": function () {
+ return toInt64(obj);
+ },
+
+ "octet": function () {
+ return toUInt8(obj);
+ },
+
+ "short": function () {
+ return toInt16(obj);
+ },
+
+ "unsigned long": function () {
+ return toUInt32(obj);
+ },
+
+ "unsigned long long": function () {
+ return toUInt64(obj);
+ },
+
+ "unsigned short": function () {
+ return toUInt16(obj);
+ },
+
+ "": function () {
+ return _self(t[pattern]).cast(obj);
+ }
+ };
+
+ return typeMap[typeOfPattern]();
+ }
+
+ function copy(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Arguments": function () {
+ var i, isNullable, ret = [];
+
+ for (i in pattern) {
+ if (i === "_optional")
+ continue;
+
+ isNullable = !!(pattern._optional && pattern._optional[i]);
+
+ if (i > obj.length - 1) {
+ if (!isNullable) {
+ return null;
+ }
+ break;
+ }
+
+ if (!isNullable || (obj[i] !== null)) {
+ ret[i] = _self(pattern[i]).copy(obj[i]);
+ if (ret[i] === null) {
+ return null;
+ }
+ }
+ }
+
+ for (i in ret) {
+ obj[i] = ret[i];
+ }
+
+ return obj;
+ },
+
+ "Array": function () {
+ var arr = [], elementType, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ return null;
+ }
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ if (obj[i] !== undefined) {
+ arr[i] = elementType.copy(obj[i]);
+ if (arr[i] === null)
+ return null;
+ }
+ }
+
+ return arr;
+ },
+
+ "Callback": function () {
+ var ret = {}, attr;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ "Object": function () {
+ var ret = {}, attr, i, derived;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return null;
+ }
+ if (!("_derived" in pattern)) {
+ return null;
+ }
+ }
+
+ if (!isConstructed(obj)) {
+ return null;
+ }
+ if ("_constructor" in pattern) {
+ ret.__proto__ = window.tizen[pattern._constructor].prototype;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ derived = _self(pattern._derived[i]).copy(obj);
+ if (derived !== null)
+ break;
+ }
+ if (derived === null) {
+ if ("_constructor" in pattern)
+ break;
+
+ return null;
+ }
+ for (attr in derived) {
+ ret[attr] = derived[attr];
+ }
+ break;
+
+ default:
+ if (!pattern._optional || !pattern._optional[attr] ||
+ (obj[attr] !== undefined) &&
+ (obj[attr] !== null)) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ break;
+ }
+ }
+
+ return ret;
+ },
+
+ "Union": function () {
+ var ret, i;
+
+ for (i in pattern) {
+ ret = _self(pattern[i]).copy(obj);
+ if (ret !== null)
+ break;
+ }
+
+ return ret;
+ },
+
+ "dictionary": function () {
+ var ret = {}, attr, base, i;
+
+ if (typeOfObj !== "Object") {
+ return null;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ base = _self(pattern._dictionary).copy(obj);
+ if (base === null) {
+ return null;
+ }
+ for (i in base) {
+ ret[i] = base[i];
+ }
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ ret[attr] = _self(pattern[attr]).copy(obj[attr]);
+ if (ret[attr] === null) {
+ return null;
+ }
+ }
+ break;
+ }
+ }
+
+ return ret;
+ },
+
+ "": function () {
+ return _self(t[pattern]).copy(obj);
+ }
+ };
+
+ return (typeOfPattern in typeMap) ? typeMap[typeOfPattern]() :
+ cast(obj);
+ }
+
+ function match(obj) {
+ var typeMap,
+ typeOfObj = getType(obj, false);
+
+ typeMap = {
+ "Array": function () {
+ var elementType, i;
+
+ if (typeOfObj !== typeOfPattern)
+ return false;
+
+ elementType = _self(pattern[0]);
+ for (i in obj) {
+ if (!elementType.match(obj[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ "Callback": function () {
+ var attr, isMatched = true;
+
+ if (typeOfObj !== "Object") {
+ return false;
+ }
+
+ for (attr in pattern) {
+ if (attr in obj) {
+ isMatched = _self(pattern[attr]).match(obj[attr]);
+ if (!isMatched) {
+ break;
+ }
+ }
+ }
+
+ return isMatched;
+ },
+
+ "DOMString": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Date": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Function": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "Object": function () {
+ var attr, isMatched = false, i;
+
+ if (typeOfObj !== typeOfPattern) {
+ if ((obj === null) || (obj === undefined)) {
+ return false;
+ }
+ if (!("_derived" in pattern)) {
+ return false;
+ }
+ return false;
+ }
+
+ if (!isConstructed(obj)) {
+ return false;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_optional":
+ case "_constructor":
+ break;
+
+ case "_derived":
+ for (i in pattern._derived) {
+ isMatched = _self(pattern._derived[i]).match(obj);
+ if (isMatched)
+ break;
+ }
+ break;
+
+ default:
+ if (pattern._optional && pattern._optional[attr]) {
+ isMatched = ((obj[attr] === null) ||
+ (obj[attr] === undefined) ||
+ _self(pattern[attr]).match(obj[attr]));
+ } else {
+ isMatched = (obj[attr] !== undefined) &&
+ _self(pattern[attr]).match(obj[attr]);
+ }
+ break;
+ }
+
+ if (!isMatched)
+ break;
+ }
+
+ /*// Check if verbose attributes are present
+ if (isMatched) {
+ for (attr in obj) {
+ if (pattern[attr] === undefined) {
+ isMatched = false;
+ break;
+ }
+ }
+ }*/
+
+ return isMatched;
+ },
+
+ "Union": function () {
+ var isMatched, i;
+
+ for (i in pattern) {
+ isMatched = _self(pattern[i]).match(obj);
+ if (isMatched)
+ break;
+ }
+
+ return isMatched;
+ },
+
+ "any": function () {
+ return true;
+ },
+
+ "boolean": function () {
+ return (typeOfObj === typeOfPattern);
+ },
+
+ "byte": function () {
+ return (obj === toInt8(obj));
+ },
+
+ "dictionary": function () {
+ var attr, isMatched = true;
+
+ if (typeOfObj !== "Object") {
+ return false;
+ }
+
+ for (attr in pattern) {
+ switch (attr) {
+ case "_dictionary":
+ if (pattern._dictionary !== null) {
+ isMatched = _self(pattern._dictionary).match(obj);
+ if (!isMatched)
+ break;
+ }
+ break;
+
+ default:
+ if ((attr in obj) && (obj[attr] !== null) &&
+ (obj[attr] !== undefined)) {
+ isMatched = _self(pattern[attr]).match(obj[attr]);
+ if (!isMatched)
+ break;
+ }
+ break;
+ }
+ }
+
+ return isMatched;
+ },
+
+ "enum": function () {
+ for (var i in pattern) {
+ if (obj === pattern[i]) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ "float": function () {
+ return (typeOfObj === "Number");
+ },
+
+ "long": function () {
+ return (obj === toInt32(obj));
+ },
+
+ "long long": function () {
+ return (obj === toInt64(obj));
+ },
+
+ "octet": function () {
+ return (obj === toUInt8(obj));
+ },
+
+ "short": function () {
+ return (obj === toInt16(obj));
+ },
+
+ "unsigned long": function () {
+ return (obj === toUInt32(obj));
+ },
+
+ "unsigned long long": function () {
+ return (obj === toUInt64(obj));
+ },
+
+ "unsigned short": function () {
+ return (obj === toUInt16(obj));
+ },
+
+ "Arguments": function () {
+ return true;
+ },
+
+ "": function () {
+ return _self(t[pattern]).match(obj);
+ }
+ };
+
+ return typeMap[typeOfPattern]();
}
+
+ typeOfPattern = getType(pattern, true);
+
+ typeCoerce = {
+ cast: cast,
+ copy: copy,
+ match: match
+ };
+
+ return typeCoerce;
};
+module.exports = _self;
});
-define('ripple/platform/wac/2.0/task', function (require, exports, module) {
+define('ripple/platform/wearable/2.0/typedef', function (require, exports, module) {
/*
- * Copyright 2011 Intel Corporation.
+ * Copyright 2014 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-var db = require('ripple/db'),
- utils = require('ripple/utils'),
- _console = require('ripple/console'),
- exception = require('ripple/exception'),
- errorcode = require('ripple/platform/wac/2.0/errorcode'),
- wac2_utils = require('ripple/platform/wac/2.0/wac2_utils'),
- PendingObject = require('ripple/platform/wac/2.0/pendingObject'),
- DeviceApiError = require('ripple/platform/wac/2.0/deviceapierror'),
- PendingOperation = require('ripple/platform/wac/2.0/pendingoperation'),
- Task, TaskList, _get,
- _ID_WITHOUT = 0, _ID_GEN_NEW = 1, _ID_FROM_PROP = 2,
- _SIM_TASK_LIST = 0, _DEVICE_TASK_LIST = 1,
- _HIGH_PRIORITY = 0, _MEDIUM_PRIORITY = 1, _LOW_PRIORITY = 2,
- _STATUS_COMPLETED = 0, _STATUS_NEEDS_ACTION = 1, _STATUS_IN_PROCESS = 2, _STATUS_CANCELLED = 3,
- _TASK_OBJECTS = "wac2.0-pim-task-objects",
- _addTaskAllowed = true, _deleteTaskAllowed = true,
- _updateTaskAllowed = true, _findTasksAllowed = true;
+var _t, _c, _i;
+/*
+ * Primitive type definition
+ */
-module.exports = function () {
- var _taskListArray = [],
- _PENDING_TIME = 10;
+_t = {
+ // Basic
+ Callback: "Callback",
+ DOMString: "",
+ Date: new Date(),
+ Function: function () {},
+ TZDate: "TZDate",
+ any: "any",
+ boolean: false,
+ byte: "byte",
+ double: "double",
+ float: "float",
+ long: "long",
+ octet: "octet",
+ short: "short",
+ long_long: "long long",
+ unsigned_long: "unsigned long",
+ unsigned_long_long: "unsigned long long",
+ unsigned_short: "unsigned short",
+
+ // Motion
+ MotionType: ["PEDOMETER", "WRIST_UP"],
+ // SAP
+ AuthenticationType: ["AUTHENTICATION_TYPE_NONE",
+ "AUTHENTICATION_TYPE_CERTIFICATE_X509"],
+ TransportType: ["TRANSPORT_BLE", "TRANSPORT_BT",
+ "TRANSPORT_USB", "TRANSPORT_WIFI"]
+};
- function _pendingOperate(operate) {
- var pendingObj, pendingOperation, i, argumentVector = [];
+/*
+ * Derivative type definition
+ */
- for (i = 0; i < arguments.length - 1; i++)
- argumentVector[i] = arguments[i + 1];
+/*
+ * Object attributes
+ * Contruct a prototype of an object. Specify a primitive type for each attribute.
+ *
+ * _optional
+ * Optional attributes table, which consists of two types of attributes,
+ *
+ * nullable
+ * Nullable attributes, marked as '?' in IDL.
+ *
+ * undefined
+ * Array type attributes, that not definitely specified to be
+ * initialized as an empty array, i.e., undefined-initialized array.
+ *
+ * _derived
+ * Derived types, which used in two cases of definition,
+ *
+ * Subtype list
+ * An array consists of derived subtypes. It exists in the definition of
+ * a base type.
+ *
+ * Union types
+ * An array consists of member types. It exists in the definition of
+ * a union type.
+ *
+ * _dictionary
+ * Dictionary type, which indicates that the object is a dictionary type.
+ */
- pendingObj = new PendingObject();
+/*
+ * IrLed
+ */
- pendingObj.pendingID = window.setTimeout(function () {
- pendingObj.setCancelFlag(false);
- operate.apply(this, argumentVector);
- }, _PENDING_TIME);
+_t.SuccessCallback = _t.Function;
+_t.ErrorCallback = _t.Function;
- pendingOperation = new PendingOperation(pendingObj);
+/*
+ * Motion
+ */
- return pendingOperation;
- }
+_t.MotionInfoSuccessCallback = _t.Function;
- /* taskProperties attribute check & paste */
- function _checkAndPasteProperties(p, dst) {
+/*
+ * SAP
+ */
- if (p.summary !== null && p.summary !== undefined)
- dst.summary = String(p.summary);
+_t.SAAgentSuccessCallback = _t.Function;
+_t.SADeviceStatusCallback = _t.Function;
+_t.SAAuthenticatePeerAgentSuccessCallback = _t.Function;
+_t.SADataReceiveCallback = _t.Function;
+_t.SASocketStatusCallback = _t.Function;
- if (p.description !== null && p.description !== undefined)
- dst.description = String(p.description);
+_t.ServiceConnectionCallback = {
+ onrequest: _t.Callback,
+ onconnect: _t.Callback,
+ onerror: _t.Callback
+};
- if (p.status !== null && p.status !== undefined) {
- if (p.status === _STATUS_COMPLETED ||
- p.status === _STATUS_NEEDS_ACTION ||
- p.status === _STATUS_IN_PROCESS ||
- p.status === _STATUS_CANCELLED) {
- dst.status = p.status;
- } else
- return false;
- }
+_t.SAPeerAgentFindCallback = {
+ onpeeragentfound: _t.Callback,
+ onpeeragentupdated: _t.Callback,
+ onerror: _t.Callback
+};
- if (p.priority !== null && p.priority !== undefined) {
- if (p.priority === _HIGH_PRIORITY ||
- p.priority === _MEDIUM_PRIORITY ||
- p.priority === _LOW_PRIORITY) {
- dst.priority = p.priority;
- } else
- return false;
- }
+_t.SAPeerAccessory = {
+ deviceAddress: _t.DOMString,
+ deviceName: _t.DOMString,
+ productId: _t.DOMString,
+ transportType: _t.TransportType,
+ vendorId: _t.DOMString
+};
- if (p.dueDate !== null && p.dueDate !== undefined) {
- if (!wac2_utils.isValidDate(p.dueDate))
- return false;
- dst.dueDate = new Date(p.dueDate);
- }
+_t.SAPeerAgent = {
+ peerAccessory: _t.SAPeerAccessory,
+ appName: _t.DOMString,
+ maxAllowedDataSize: _t.long,
+ peerId: _t.DOMString,
+ profileVersion: _t.DOMString
+};
- /* dueDate is a option properties.
- "The default value is undefined.
- If no value is provided, the task has no due date."
- If p.dueDate is set its default value 'undefined',
- we assign default value to dst.dueDate */
- if (p.dueDate === undefined) {
- dst.dueDate = undefined;
- }
+_t.SAFileSendCallback = {
+ onprogress: _t.Callback,
+ oncomplete: _t.Callback,
+ onerror: _t.Callback
+};
- return true;
- }
+_t.SAFileReceiveCallback = {
+ onreceive: _t.Callback,
+ onprogress: _t.Callback,
+ oncomplete: _t.Callback,
+ onerror: _t.Callback
+};
- function _taskFilterCheck(filter) {
- var i;
- if (filter.id !== undefined && filter.id !== null) {
- filter.id = String(filter.id);
- } else {
- filter.id = undefined;
- }
- if (filter.summary !== undefined && filter.summary !== null) {
- filter.summary = String(filter.summary);
- } else {
- filter.summary = undefined;
- }
- if (filter.description !== undefined && filter.description !== null) {
- filter.description = String(filter.description);
- } else {
- filter.description = undefined;
- }
- if (filter.status !== undefined && filter.status !== null) {
- if (!wac2_utils.isValidArray(filter.status)) {
- return false;
- }
- for (i = 0; i < filter.status.length; i++) {
- filter.status[i] = filter.status[i] | 0;
- if (filter.status[i] !== _STATUS_COMPLETED &&
- filter.status[i] !== _STATUS_NEEDS_ACTION &&
- filter.status[i] !== _STATUS_IN_PROCESS &&
- filter.status[i] !== _STATUS_CANCELLED) {
- return false;
- }
- }
- } else {
- filter.status = undefined;
- }
- if (filter.priority !== undefined && filter.priority !== null) {
- if (!wac2_utils.isValidArray(filter.priority)) {
- return false;
- }
- for (i = 0; i < filter.priority.length; i++) {
- filter.priority[i] = filter.priority[i] | 0;
- if (filter.priority[i] !== _HIGH_PRIORITY &&
- filter.priority[i] !== _MEDIUM_PRIORITY &&
- filter.priority[i] !== _LOW_PRIORITY) {
- return false;
- }
- }
- } else {
- filter.priority = undefined;
- }
- if (filter.dueDate !== undefined && filter.dueDate !== null) {
- if (!wac2_utils.isValidDate(filter.dueDate)) {
- return false;
- }
- filter.dueDate = new Date(filter.dueDate);
- } else {
- filter.dueDate = undefined;
- }
- return true;
- }
+/*
+ * Constructor list definition
+ */
- function TaskProperties(prop) {
- var _self;
- _self = {
- priority : _LOW_PRIORITY,
- description : "",
- summary : "",
- dueDate : undefined,
- status : _STATUS_NEEDS_ACTION
- };
- if (prop) {
- if (_checkAndPasteProperties(prop, _self) === false)
- return undefined;
- }
- return _self;
- }
+/*
+ * Generic constructor
+ * Construct a prototype of constructor. A fake array of arguments type is
+ * specified for constructor.
+ *
+ * Overloaded constructors
+ * Construct an array of prototype of constructor. Each array element is
+ * specified for one of constructors. The constructor with extra arguments
+ * are recommended to be defined ahead of the one with fewer same arguments
+ * for exact match.
+ */
- function Task(prop, idChoice) {
- var id, _self = new TaskProperties(prop);
- /* if error occurs during checking, _self is an empty object.
- so i randomly pick description to check if property check fails */
- if (_self.description === undefined)
- return undefined;
+_c = {};
- switch (idChoice) {
- case _ID_WITHOUT:
- // do nothing
- break;
- case _ID_GEN_NEW:
- id = Math.uuid(undefined, 16);
- _self.__defineGetter__("id", function () {
- return id;
- });
- break;
- case _ID_FROM_PROP:
- id = String(prop.id);
- _self.__defineGetter__("id", function () {
- return id;
- });
- break;
- }
+/*
+ * Interface prototype definition
+ */
- return _self;
- }
+_i = {
+ // IrLed
+ IrLedManager: {},
- function _get() {
- var taskListArray = [],
- data = db.retrieveObject(_TASK_OBJECTS);
- utils.forEach(data, function (taskList) {
- for (var t in taskList._list) {
- if (taskList._list[t].dueDate !== undefined &&
- taskList._list[t].dueDate !== null)
- taskList._list[t].dueDate = new Date(taskList._list[t].dueDate);
- }
- taskListArray.push(new TaskList(taskList._list, taskList.type, taskList.name));
- });
+ // Motion
+ MotionManager: {},
- /* add default taskList if taskListArray is empty */
- if (taskListArray.length === 0) {
- taskListArray = [new TaskList({}, 0, "Office tasks"), new TaskList({}, 1, "Home tasks")];
- }
+ // SAP
+ SAManager: {},
+ SAAgent: {},
+ SASocket: {},
+ SAFileTransfer: {}
+};
- return taskListArray;
- }
+// IrLed
+_i.IrLedManager.send = {
+ 0: _t.DOMString,
+ 1: _t.SuccessCallback,
+ 2: _t.ErrorCallback,
- function _save() {
- db.saveObject(_TASK_OBJECTS, _taskListArray);
+ _optional: {
+ // nullable
+ 1: true,
+ 2: true
}
+};
- function TaskList(taskList, type, name) {
- var task;
- this._list = taskList;
- this.type = type;
- this.name = name;
-
- this.createTask = function (properties) {
- task = new Task(properties, _ID_WITHOUT);
- /* if error occurs during checking, task is an empty object.
- so i randomly pick summary to check if property check fails */
- if (task.summary === undefined) {
- exception.raise(exception.types.Argument,
- "EventProperties: input parameter contains invalid values",
- new DeviceApiError(errorcode.INVALID_VALUES_ERR));
- return undefined;
- }
- return task;
- };
-
- this.addTask = function (onSuccess, onError, task) {
- var inner = this,
- newTask, _task = Object(task);
- function _addTask() {
- var ret;
- if (!_addTaskAllowed) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.SECURITY_ERR));
- }, 1);
- }
- return undefined;
- }
- newTask = new Task(_task, _ID_GEN_NEW);
- /* if error occurs during checking, newTask is an empty object.
- so i randomly pick id to check if property check fails */
- if (newTask.id === undefined) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
- }, 1);
- }
- return undefined;
- }
- ret = _pendingOperate(function () {
- inner._list[newTask.id] = newTask;
- _save();
- onSuccess(new Task(newTask, _ID_FROM_PROP));
- });
- }
-
- return wac2_utils.validateTypeMismatch(onSuccess, onError, "addTask", _addTask);
- };
-
- this.updateTask = function (onSuccess, onError, task) {
- var inner = this,
- newTask, _task = Object(task);
- function _updateTask() {
- var ret;
- if (!_updateTaskAllowed) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.SECURITY_ERR));
- }, 1);
- }
- return undefined;
- }
-
- if (_checkAndPasteProperties(_task, _task) === false) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
- }, 1);
- }
- return undefined;
- }
+// Motion
+_i.MotionManager.getMotionInfo = {
+ 0: _t.MotionType,
+ 1: _t.MotionInfoSuccessCallback,
+ 2: _t.ErrorCallback,
- ret = _pendingOperate(function () {
- if (inner._list[_task.id]) {
- newTask = new Task(inner._list[_task.id], _ID_FROM_PROP);
- /* Don't need to double check the return of _checkAndPasteProperties
- _task has been checked & pasted already */
- _checkAndPasteProperties(_task, newTask);
- inner._list[newTask.id] = newTask;
- _save();
- onSuccess();
- } else {
- if (onError) {
- onError(new DeviceApiError(errorcode.NOT_FOUND_ERR));
- }
- }
- });
- return ret;
- }
+ _optional: {
+ // nullable
+ 2: true
+ }
+};
- return wac2_utils.validateTypeMismatch(onSuccess, onError, "updateTask", _updateTask);
- };
+_i.MotionManager.start = {
+ 0: _t.MotionType,
+ 1: _t.MotionInfoSuccessCallback,
- this.deleteTask = function (onSuccess, onError, id) {
- var inner = this;
- function _deleteTask() {
- var ret;
- /* according to spec "If any of the input parameters are not
- compatible with the expected type for that parameter,
- a DeviceAPIError with code TYPE_MISMATCH_ERR MUST be
- synchronously thrown." so an error is raised synchronously */
- utils.validateArgumentType(id, "string", null,
- "Task:deleteTask: " + " invalid id parameter",
- new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
- if (!_deleteTaskAllowed) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.SECURITY_ERR));
- }, 1);
- }
- return undefined;
- }
- ret = _pendingOperate(function () {
- if (inner._list[id]) {
- delete inner._list[id];
- _save();
- onSuccess();
- } else {
- if (onError)
- onError(new DeviceApiError(errorcode.NOT_FOUND_ERR));
- }
- });
- return ret;
- }
+ _optional: {
+ // nullable
+ 1: true
+ }
+};
- return wac2_utils.validateTypeMismatch(onSuccess, onError, "deleteTask", _deleteTask);
- };
+_i.MotionManager.stop = {
+ 0: _t.MotionType
+};
- this.findTasks = function (onSuccess, onError, filter) {
- var inner = this, _filter = Object(filter), tmp = [], rst = [], valid_tmp = false;
- function _findTasks() {
- var ret;
- if (!_taskFilterCheck(_filter)) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
- }, 1);
- }
- return undefined;
- }
- if (!_findTasksAllowed) {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.SECURITY_ERR));
- }, 1);
- }
- return undefined;
- }
- ret = _pendingOperate(function () {
- var i, e;
- if (_filter.id !== undefined) {
- tmp = wac2_utils.matchOptionString(inner._list, "id", _filter.id);
- valid_tmp = true;
- }
- if (_filter.summary !== undefined) {
- if (valid_tmp) {
- tmp = wac2_utils.matchOptionString(tmp, "summary", _filter.summary);
- } else {
- tmp = wac2_utils.matchOptionString(inner._list, "summary", _filter.summary);
- valid_tmp = true;
- }
- }
- if (_filter.description !== undefined) {
- if (valid_tmp) {
- tmp = wac2_utils.matchOptionString(tmp, "description", _filter.description);
- } else {
- tmp = wac2_utils.matchOptionString(inner._list, "description", _filter.description);
- valid_tmp = true;
- }
- }
- if (_filter.status !== undefined) {
- if (valid_tmp) {
- tmp = wac2_utils.matchOptionShortArray(tmp, "status", _filter.status);
- } else {
- tmp = wac2_utils.matchOptionShortArray(inner._list, "status", _filter.status);
- valid_tmp = true;
- }
- }
- if (_filter.priority !== undefined) {
- if (valid_tmp) {
- tmp = wac2_utils.matchOptionShortArray(tmp, "priority", _filter.priority);
- } else {
- tmp = wac2_utils.matchOptionShortArray(inner._list, "priority", _filter.priority);
- valid_tmp = true;
- }
- }
- if (_filter.initialDueDate !== undefined ||
- _filter.endDueDate !== undefined) {
- if (valid_tmp) {
- tmp = wac2_utils.matchOptionDate(tmp, "dueDate", _filter.initialDueDate, _filter.endDueDate);
- } else {
- tmp = wac2_utils.matchOptionDate(inner._list, "dueDate", _filter.initialDueDate, _filter.endDueDate);
- valid_tmp = true;
- }
- }
+/*
+ * SAP
+ */
- if (valid_tmp) {
- for (i = 0; i < tmp.length; i++) {
- rst.push(new Task(tmp[i], _ID_FROM_PROP));
- }
- } else {
- for (e in inner._list) {
- rst.push(new Task(inner._list[e], _ID_FROM_PROP));
- }
- }
- onSuccess(rst);
- });
- return ret;
- }
+// SAManager
+_i.SAManager.requestSAAgent = {
+ 0: _t.SAAgentSuccessCallback,
+ 1: _t.ErrorCallback,
- return wac2_utils.validateTypeMismatch(onSuccess, onError, "findTasks", _findTasks);
- };
+ _optional: {
+ // nullable
+ 1: true
}
+};
- this.getTaskLists = function (onSuccess, onError) {
- function _getTaskLists() {
- var ret;
- ret = _pendingOperate(function () {
- if (_taskListArray.length === 0) {
- _taskListArray = _get();
- }
- onSuccess(_taskListArray);
- }, 1);
- return ret;
- }
-
- return wac2_utils.validateTypeMismatch(onSuccess, onError, "getTaskLists", _getTaskLists);
- };
+_i.SAManager.setDeviceStatusListener = {
+ 0: _t.SADeviceStatusCallback
+};
- this.__defineGetter__("SIM_TASK_LIST", function () {
- return 0;
- });
- this.__defineGetter__("DEVICE_TASK_LIST", function () {
- return 1;
- });
- this.__defineGetter__("HIGH_PRIORITY", function () {
- return 0;
- });
- this.__defineGetter__("MEDIUM_PRIORITY", function () {
- return 1;
- });
- this.__defineGetter__("LOW_PRIORITY", function () {
- return 2;
- });
- this.__defineGetter__("STATUS_COMPLETED", function () {
- return 0;
- });
- this.__defineGetter__("STATUS_NEEDS_ACTION", function () {
- return 1;
- });
- this.__defineGetter__("STATUS_IN_PROCESS", function () {
- return 2;
- });
- this.__defineGetter__("STATUS_CANCELLED", function () {
- return 3;
- });
+// SAAgent
+_i.SAAgent.requestServiceConnection = {
+ 0: _t.SAPeerAgent
+};
- this.handleSubFeatures = function (subFeatures) {
- if (wac2_utils.isEmptyObject(subFeatures) ||
- subFeatures["http://wacapps.net/api/pim.task"] ||
- (subFeatures["http://wacapps.net/api/pim.task.read"] &&
- subFeatures["http://wacapps.net/api/pim.task.write"])) {
- return;
- }
- if (subFeatures["http://wacapps.net/api/pim.task.read"] &&
- !subFeatures["http://wacapps.net/api/pim.task.write"]) {
- _addTaskAllowed = false;
- _deleteTaskAllowed = false;
- _updateTaskAllowed = false;
- return;
- }
- if (subFeatures["http://wacapps.net/api/pim.task.write"] &&
- !subFeatures["http://wacapps.net/api/pim.task.read"]) {
- _findTasksAllowed = false;
- return;
- }
- _console.warn("WAC-2.0-Task-handleSubFeatures: something wrong");
- };
+_i.SAAgent.setServiceConnectionListener = {
+ 0: _t.ServiceConnectionCallback
+};
+_i.SAAgent.authenticatePeerAgent = {
+ 0: _t.SAPeerAgent,
+ 1: _t.SAAuthenticatePeerAgentSuccessCallback,
};
+_i.SAAgent.acceptServiceConnectionRequest = {
+ 0: _t.SAPeerAgent
+};
-});
-define('ripple/platform/wac/2.0/typecoerce', function (require, exports, module) {
-/*\r
- * Copyright 2011 Intel Corporation.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-var utils = require('ripple/utils'),\r
- _self;\r
-\r
-_self = function (pattern) {\r
- var typeCoerce,\r
- typeOfPattern = Object.prototype.toString.call(pattern);\r
-\r
- typeCoerce = {\r
- cast: function (obj) {\r
- var validObj,\r
- validValue,\r
- elementType,\r
- typeOfObj = Object.prototype.toString.call(obj);\r
-\r
- switch (typeOfPattern) {\r
- case "[object String]":\r
- validObj = (typeOfObj !== typeOfPattern) ? String(obj) : obj;\r
- break;\r
-\r
- case "[object Number]":\r
- validObj = (typeOfObj !== typeOfPattern) ? (Number(obj) | 0) : obj;\r
- break;\r
-\r
- case "[object Object]":\r
- if (typeOfObj !== typeOfPattern) {\r
- validObj = {};\r
- } else {\r
- validObj = obj;\r
- utils.forEach(validObj, function (value, key) {\r
- if (pattern[key] === undefined) {\r
- delete validObj[key];\r
- } else {\r
- validValue = _self(pattern[key]).cast(value);\r
- if (validObj[key] !== validValue)\r
- validObj[key] = validValue;\r
- }\r
- });\r
- }\r
- break;\r
-\r
- case "[object Array]":\r
- if (typeOfObj !== typeOfPattern) {\r
- validObj = [];\r
- } else {\r
- validObj = obj;\r
- elementType = _self(pattern[0]);\r
- utils.forEach(validObj, function (element, index) {\r
- validObj[index] = elementType.cast(element);\r
- });\r
- }\r
- break;\r
- }\r
-\r
- return validObj;\r
- }\r
- };\r
-\r
- return typeCoerce;\r
-};\r
-\r
-module.exports = _self;\r
+_i.SAAgent.rejectServiceConnectionRequest = {
+ 0: _t.SAPeerAgent
+};
-});
-define('ripple/platform/wac/2.0/wac2_utils', function (require, exports, module) {
-/*
- * Copyright 2011 Intel Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+_i.SAAgent.findPeerAgents = null;
-var utils = require('ripple/utils'),
- errorcode = require('ripple/platform/wac/2.0/errorcode'),
- DeviceApiError = require('ripple/platform/wac/2.0/deviceapierror');
+_i.SAAgent.setPeerAgentFindListener = {
+ 0: _t.SAPeerAgentFindCallback
+};
-module.exports = {
- _wac2_regexSanitize: function (regexString) {
- var escapePattern = /([^\\]|^)(%)/g, percentPattern = /\\%/g;
- return regexString.replace("^", "\\^")
- .replace("$", "\\$")
- .replace("(", "\\(")
- .replace(")", "\\)")
- .replace("<", "\\<")
- .replace("[", "\\[")
- .replace("{", "\\{")
- .replace(/\\([^%])/, "\\\\$1") /* don't replace \\% */
- .replace("|", "\\|")
- .replace(">", "\\>")
- .replace(".", "\\.")
- .replace("*", "\\*")
- .replace("+", "\\+")
- .replace("?", "\\?")
- .replace(escapePattern, "$1.*") /* replace % with .* */
- .replace(percentPattern, "%"); /* strip excape of % */
- },
+_i.SAAgent.getSAFileTransfer = null;
- isValidDate: function (d) {
- if (Object.prototype.toString.call(d) !== "[object Date]")
- return false;
- return !isNaN(d.getTime());
- },
+// SASocket
+_i.SASocket.close = null;
- isValidArray: function (a) {
- return (Object.prototype.toString.call(a) === "[object Array]");
- },
-
- matchOptionArrayString: function (src, attr, pattern) {
- /* src.obj[attr] is a StringArray */
- var _pattern, re, _stringMatch;
- _pattern = this._wac2_regexSanitize(pattern);
- re = new RegExp("^" + _pattern + "$", "i");
+_i.SASocket.isConnected = null;
- _stringMatch = function (obj, index) {
- if (pattern.search(/^%*$/i) === 0)
- return true;
- if (obj[attr] === undefined || obj[attr] === null)
- return false;
- return obj[attr].some(function (f) {
- return f.search(re) !== -1;
- });
- };
- return utils.filter(src, _stringMatch);
- },
+_i.SASocket.sendData = {
+ 0: _t.long,
+ 1: _t.DOMString
+};
- matchOptionString: function (src, attr, pattern) {
- /* src.obj[attr] is a string */
- var _stringMatch, _pattern, _re;
- _pattern = this._wac2_regexSanitize(pattern);
- _re = new RegExp("^" + _pattern + "$", "mi");
+_i.SASocket.sendSecureData = {
+ 0: _t.long,
+ 1: _t.DOMString
+};
- _stringMatch = function (obj, index) {
- return (obj[attr].search(_re) !== -1);
- };
- return utils.filter(src, _stringMatch);
- },
+_i.SASocket.setDataReceiveListener = {
+ 0: _t.SADataReceiveCallback
+};
- matchOptionDate: function (src, attr, filterStart, filterEnd) {
- var _dateMatch;
- _dateMatch = function (obj, index) {
- var matched = true, valueDate = obj[attr];
-
- if (filterStart !== undefined && filterStart !== null) {
- matched = (valueDate.getTime() >= filterStart.getTime());
- }
- if (matched && (filterEnd !== undefined && filterEnd !== null)) {
- matched = (valueDate.getTime() <= filterEnd.getTime());
- }
- return matched;
- };
- return utils.filter(src, _dateMatch);
- },
+_i.SASocket.setSocketStatusListener = {
+ 0: _t.SASocketStatusCallback
+};
- matchOptionShortArray: function (src, attr, filterArray) {
- /* src.obj[attr] is a short, filterArray is an array
- i.e. find status is [CONFRIMED or TENTATIVE] */
- var arraySome = function (obj, index) {
- return filterArray.some(function (f) {
- return f === obj[attr];
- });
- };
- return utils.filter(src, arraySome);
- },
+// SAFileTransfer
+_i.SAFileTransfer.sendFile = {
+ 0: _t.SAPeerAgent,
+ 1: _t.DOMString
+};
- validateTypeMismatch: function (onSuccess, onError, name, callback) {
- if (onSuccess) {
- utils.validateArgumentType(onSuccess, "function", null,
- name + " invalid successCallback parameter",
- new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
- }
+_i.SAFileTransfer.setFileSendListener = {
+ 0: _t.SAFileSendCallback
+};
- if (onError) {
- utils.validateArgumentType(onError, "function", null,
- name + " invalid errorCallback parameter",
- new DeviceApiError(errorcode.TYPE_MISMATCH_ERR));
- }
+_i.SAFileTransfer.setFileReceiveListener = {
+ 0: _t.SAFileReceiveCallback
+};
- if (onSuccess) {
- return callback && callback();
- } else {
- if (onError) {
- setTimeout(function () {
- onError(new DeviceApiError(errorcode.INVALID_VALUES_ERR));
- }, 1);
- }
- }
- return undefined;
- },
+_i.SAFileTransfer.receiveFile = {
+ 0: _t.long,
+ 1: _t.DOMString
+};
- isEmptyObject: function (obj) {
- var prop;
+_i.SAFileTransfer.cancelFile = {
+ 0: _t.long
+};
- for (prop in obj) {
- return false;
- }
- return true;
- }
+_i.SAFileTransfer.rejectFile = {
+ 0: _t.long
};
+// Exports
+_t.constructor = _c;
+_t.interface = _i;
+
+module.exports = _t;
});
define('ripple/platform/web/default/device', function (require, exports, module) {
platformName = "tizen";
platformVersion = "2.0";
}
+ else if (platformName === "wearable") {
+ platformName = "wearable";
+ platformVersion = "2.0";
+ }
else {
platformName = "ivi";
platformVersion = "3.0";
platformId = "tizen";
version = "2.0";
}
+ else if (platformId === "wearable") {
+ platformId = "wearable";
+ version = "2.0";
+ }
else {
platformId = "ivi";
version = "3.0";
$("#overlayBackground").css("height", $(window).height());
});
- if (jQuery("#platform-select").val() === "ivi") {
+ if (jQuery("#platform-select").val() === "ivi" || jQuery("#platform-select").val() === "wearable") {
jQuery("#configuration-window-save-btn").hide();
jQuery("#configuration-window-load-btn").hide();
};
});
+define('ripple/ui/plugins/irled', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var event = require('ripple/event');
+
+module.exports = {
+ panel: {
+ domId: "irled-container",
+ collapsed: true,
+ pane: "right",
+ titleName: "IrLed",
+ display: true
+ },
+
+ initialize: function () {
+ event.on("irled-send-data", function (data) {
+ $("#data").html(data);
+ });
+ }
+};
+
+});
define('ripple/ui/plugins/layout', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
};
});
+define('ripple/ui/plugins/motion', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var event = require('ripple/event');
+
+module.exports = {
+ panel: {
+ domId: "motion-container",
+ collapsed: true,
+ pane: "right",
+ titleName: "Motion Information",
+ display: false
+ },
+
+ initialize: function () {
+ event.on("wearable-motion-pedometer-data", function (data) {
+ var key, value, className;
+
+ for (key in data) {
+ className = "motion-data-" + key;
+ value = data[key];
+
+ jQuery("#motion-data ." + className).html(value);
+ }
+ });
+ }
+};
+
+});
define('ripple/ui/plugins/multimedia', function (require, exports, module) {
/*
* Copyright 2011 Research In Motion Limited.
devicesSelect.appendChild(deviceNode);
});
- if (platformID === "ivi") {
+ if (platformID === "ivi" || platformID === "wearable") {
jQuery("#configuration-window-save-btn").hide();
jQuery("#configuration-window-load-btn").hide();
}
}
-function _unlockScreen() {
- if (!deviceSettings.retrieve("Config.lockScreen"))
- return;
-
- if ($("#device-settings-Config-lockScreen").length === 0) {
- deviceSettings.persist("Config.lockScreen", false);
- } else {
- $("#device-settings-Config-lockScreen")[0].click();
- }
-}
-
function checkResolutionSize(evt) {
var query_str, id_str, len;
query_str = "#resolution-custom-" + evt.data.msg;
};
});
+define('ripple/ui/plugins/sap', function (require, exports, module) {
+/*
+ * Copyright 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var event = require('ripple/event'),
+ utils = require('ripple/utils'),
+ _data = {
+ TIMEOUT: 100,
+ peerAgent: null,
+ remotePeerAgent: null,
+ agentId: "",
+ remoteAgentId: "",
+ t: null,
+ count: 0
+ };
+
+function _disableWearableRequest(val) {
+ if (val !== "") {
+ jQuery("#sap-service-connection-accept, #sap-service-connection-reject").attr("disabled", val);
+ }
+ else {
+ jQuery("#sap-service-connection-accept, #sap-service-connection-reject").removeAttr("disabled", val);
+ }
+}
+
+function _loadWearablePanel() {
+ _disableWearableRequest("disabled");
+ jQuery("#sap-host-gear-sending").attr("disabled", "disabled");
+ jQuery("#sap-android-service-connection-requests").removeAttr("disabled");
+}
+
+function _startWearableRequest() {
+ _data.t = window.setInterval(function () {
+ _data.count++;
+
+ jQuery("#sap-service-connection-request p.messaging").fadeOut(100).fadeIn(100);
+
+ if (_data.count > _data.TIMEOUT) {
+ _stopWearableRequest();
+ }
+ }, 200);
+ _disableWearableRequest("");
+}
+
+function _stopWearableRequest() {
+ _data.count = 0;
+ window.clearInterval(_data.t);
+ _disableWearableRequest("disabled");
+
+ if (_data.count > _data.TIMEOUT) {
+ event.trigger("wearable-service-connection-response",
+ [_data.agentId, _data.peerAgent, "PEERAGENT_NO_RESPONSE"]);
+ }
+}
+
+function _initialize() {
+ jQuery("#sap-sending-receiving").tabs();
+
+ jQuery("#sap-device-detach").bind("click", function () {
+ var type = jQuery("#sap-transport").val();
+
+ jQuery("#sap-device-detach").attr("disabled", "disabled");
+ jQuery("#sap-host-app").hide();
+ _loadWearablePanel();
+
+ event.trigger("wearableDeviceDetached", [type, "DETACHED"]);
+ });
+
+ jQuery("#sap-service-connection-accept").bind("click", function () {
+ if (_data.agentId !== "") {
+ jQuery("#sap-service-connection-request p.messaging")
+ .html("Accept requesting.");
+
+ event.trigger("wearableServiceConnected",
+ [_data.agentId, _data.peerAgent, "OK"]);
+ }
+ _stopWearableRequest();
+ jQuery("#sap-host-gear-sending").removeAttr("disabled");
+ jQuery("#sap-android-service-connection-requests").attr("disabled", "disabled");
+ });
+
+ jQuery("#sap-service-connection-reject").bind("click", function () {
+ var status = jQuery("#sap-service-connection-request input").val();
+
+ if (status !== "") {
+ jQuery("#sap-service-connection-request p.messaging")
+ .html("Reject requesting.");
+
+ event.trigger("wearableServiceConnected",
+ [_data.agentId, _data.peerAgent, "PEERAGENT_REJECTED"]);
+
+ _data.peerAgent = null;
+ _data.agentId = "";
+ }
+ _stopWearableRequest();
+ });
+
+ jQuery("#sap-android-service-connection-requests").bind("click", function () {
+ jQuery("#sap-android-service-connection-request p.messaging")
+ .html("Request connection: " + _data.remotePeerAgent.appName + ".");
+
+ event.trigger("wearableRemoteServiceRequested", [_data.remoteAgentId,
+ _data.remotePeerAgent]);
+ });
+
+ jQuery("#sap-host-gear-sending").bind("click", function () {
+ var data = jQuery("#sap-host-gear-data-sending").val(),
+ localPath = jQuery("#sap-host-gear-file-sending").val(),
+ checked = jQuery("input[name='sap-send']:checked");
+
+ if (checked.val() === "1")
+ event.trigger("wearableRemoteSocketDataSent", [_data.peerAgent, 0, data.trim()]);
+ if (checked.val() === "2")
+ event.trigger("wearableRemoteFileTransfered", [0, localPath.trim()]);
+ });
+}
+
+module.exports = {
+ panel: {
+ domId: "sap-container",
+ collapsed: true,
+ pane: "right",
+ titleName: "SAP Service",
+ display: true
+ },
+ initialize: function () {
+ _initialize();
+ _loadWearablePanel();
+
+ event.on("wearableSAAgentsValid", function (ids) {
+ _data.remoteAgentId = ids[0];
+ });
+
+ event.on("wearablePeerAgentsSimulated", function (peerAgents) {
+ var html = "";
+
+ utils.forEach(peerAgents, function (item) {
+ var _appPeerAgentInfo = jQuery("#sap-host-app-info").html();
+
+ html += _appPeerAgentInfo.replace(/#appName/g, item.appName)
+ .replace(/#peerId/g, item.peerId)
+ .replace(/#maxAllowedDataSize/g, item.maxAllowedDataSize)
+ .replace(/#profileVersion/g, item.profileVersion)
+ .replace(/#deviceAddress/g, item.peerAccessory.deviceAddress)
+ .replace(/#deviceName/g, item.peerAccessory.deviceName)
+ .replace(/#productId/g, item.peerAccessory.productId)
+ .replace(/#transportType/g, item.peerAccessory.transportType)
+ .replace(/#vendorId/g, item.peerAccessory.vendorId);
+
+ _data.remotePeerAgent = item;
+ });
+
+ jQuery("#sap-host-app-info").html(html);
+ });
+
+ event.on("wearableDeviceAttached", function () {
+ jQuery("#sap-host-app").show();
+ jQuery("#sap-device-detach").removeAttr("disabled");
+ });
+
+ event.on("wearableServiceRequested", function (agentId, peerAgent) {
+ var requestMsg = "Request connection: " + peerAgent.appName + ".";
+
+ if (_data.agentId === agentId && _data.peerAgent) {
+ event.trigger("wearable-service-connection-response",
+ [agentId, peerAgent, "ALREADY_EXIST"]);
+ return;
+ }
+
+ jQuery("#sap-service-connection-request p.messaging").html(requestMsg);
+
+ _data.peerAgent = peerAgent;
+ _data.agentId = agentId;
+ _startWearableRequest();
+ });
+
+ event.on("wearableRemoteServiceConnected", function (status, peerAgent) {
+ var requestMsg = "Accept Connecting " + peerAgent.appName;
+
+ if (!status) {
+ requestMsg = "Reject connecting " + peerAgent.appName;
+ }
+ else {
+ _disableWearableRequest("disabled");
+ jQuery("#sap-host-gear-sending").removeAttr("disabled");
+ jQuery("#sap-android-service-connection-requests").attr("disabled", "disabled");
+ }
+ jQuery("#sap-android-service-connection-request p.messaging").html(requestMsg);
+ });
+
+ event.on("wearableSocketDataSent", function (iSecure, channelId, data) {
+ var msg = "[#CHANNELID#ISENCRYPTED]: #DATA";
+ msg = msg.replace("#CHANNELID", channelId)
+ .replace("#ISENCRYPTED", iSecure ? ", Encrypted" : "")
+ .replace("#DATA", data);
+ jQuery("#sap-gear-host-data-receiving").html(msg);
+ });
+
+ event.on("wearableSocketClosed", function () {
+ _data.agentId = "";
+ _loadWearablePanel();
+ jQuery("#sap-service-connection-request p.messaging").html("Connection closed.");
+ });
+
+ event.on("wearableFileTransfered", function (peerAgent, filePath) {
+ jQuery("#sap-gear-host-file-receiving").html(filePath);
+
+ event.trigger("wearableFileTransferCompleted", [0, filePath]);
+ });
+ }
+};
+
+});
define('ripple/ui/plugins/secureElement', function (require, exports, module) {
/*
* Copyright 2014 Intel Corporation
}
status = true;
- event.trigger("vehicle-history-response", [historyResponse, status]);
+ event.trigger("vehicle-history-response", [property, historyResponse, status]);
});
}