Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiftify #4

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions iOS/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
line_length: 120


176 changes: 91 additions & 85 deletions iOS/libraries/WWRobotAPI.framework/Versions/A/Headers/WWConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@

#define WW_LAUNCHER_POWER_MIN 0.0
#define WW_LAUNCHER_POWER_MAX 1.0
typedef unsigned int WWLauncherReloadDirection;
#define WW_LAUNCHER_RELOAD_LEFT 1
#define WW_LAUNCHER_RELOAD_RIGHT 2

typedef NS_ENUM(NSUInteger, WWLauncherReloadDirection) {
WW_LAUNCHER_RELOAD_LEFT = 1,
WW_LAUNCHER_RELOAD_RIGHT = 2
};

// on-robot file syntax definitions
#define WW_ON_ROBOT_DIR_LENGTH 4
Expand All @@ -41,81 +43,85 @@ typedef unsigned int WWLauncherReloadDirection;


// defines for componentIds (used for CommandSet and SensorSet)
typedef unsigned int WWComponentId;
#define WW_COMMAND_POWER 1
#define WW_COMMAND_EYE_RING 100
#define WW_COMMAND_LIGHT_RGB_EYE 101
#define WW_COMMAND_LIGHT_RGB_LEFT_EAR 102
#define WW_COMMAND_LIGHT_RGB_RIGHT_EAR 103
#define WW_COMMAND_LIGHT_RGB_CHEST 104
#define WW_COMMAND_LIGHT_MONO_TAIL 105
#define WW_COMMAND_LIGHT_MONO_BUTTON_MAIN 106
#define WW_COMMAND_HEAD_POSITION_TILT 202
#define WW_COMMAND_HEAD_POSITION_PAN 203
#define WW_COMMAND_BODY_LINEAR_ANGULAR 204
#define WW_COMMAND_BODY_POSE 205
#define WW_COMMAND_MOTOR_HEAD_BANG 210
#define WW_COMMAND_BODY_WHEELS 211
#define WW_COMMAND_BODY_COAST 212
#define WW_COMMAND_SPEAKER 300
#define WW_COMMAND_ON_ROBOT_ANIM 301
#define WW_COMMAND_LAUNCHER_FLING 400
#define WW_COMMAND_LAUNCHER_RELOAD 401
#define WW_SENSOR_BUTTON_MAIN 1000
#define WW_SENSOR_BUTTON_1 1001
#define WW_SENSOR_BUTTON_2 1002
#define WW_SENSOR_BUTTON_3 1003
#define WW_SENSOR_HEAD_POSITION_PAN 2000
#define WW_SENSOR_HEAD_POSITION_TILT 2001
#define WW_SENSOR_BODY_POSE 2002
#define WW_SENSOR_ACCELEROMETER 2003
#define WW_SENSOR_GYROSCOPE 2004
#define WW_SENSOR_DISTANCE_FRONT_LEFT_FACING 3000
#define WW_SENSOR_DISTANCE_FRONT_RIGHT_FACING 3001
#define WW_SENSOR_DISTANCE_BACK 3002
#define WW_SENSOR_ENCODER_LEFT_WHEEL 3003
#define WW_SENSOR_ENCODER_RIGHT_WHEEL 3004
#define WW_SENSOR_MICROPHONE 3005


typedef unsigned int WWRobotType;
#define WW_ROBOT_UNKNOWN 1000
#define WW_ROBOT_DASH 1001
#define WW_ROBOT_DOT 1002

typedef unsigned int WWPersonalityColorIndex;
#define WW_PERSONALITY_COLOR_NONE 0 // aka white
#define WW_PERSONALITY_COLOR_YELLOW 1 // do not renumber these!
#define WW_PERSONALITY_COLOR_GREEN 2
#define WW_PERSONALITY_COLOR_ORANGE 3
#define WW_PERSONALITY_COLOR_BLUE 4
#define WW_PERSONALITY_COLOR_RED 5
#define WW_PERSONALITY_COLOR_PURPLE 6
#define WW_PERSONALITY_COLOR_INVALID 255

typedef unsigned int WWRobotColorIndex; // same as WWPersonalityColorIndex with additional values.
#define WW_ROBOT_COLOR_WHITE WW_PERSONALITY_COLOR_NONE
#define WW_ROBOT_COLOR_YELLOW WW_PERSONALITY_COLOR_YELLOW
#define WW_ROBOT_COLOR_GREEN WW_PERSONALITY_COLOR_GREEN
#define WW_ROBOT_COLOR_ORANGE WW_PERSONALITY_COLOR_ORANGE
#define WW_ROBOT_COLOR_BLUE WW_PERSONALITY_COLOR_BLUE
#define WW_ROBOT_COLOR_RED WW_PERSONALITY_COLOR_RED
#define WW_ROBOT_COLOR_PURPLE WW_PERSONALITY_COLOR_PURPLE
#define WW_ROBOT_COLOR_BLUE2 (WW_PERSONALITY_COLOR_PURPLE + 1)
#define WW_ROBOT_COLOR_OFF (WW_PERSONALITY_COLOR_PURPLE + 2)
#define WW_ROBOT_COLOR_INVALID WW_PERSONALITY_COLOR_INVALID


typedef unsigned int WWPersonalityAnimationIndex;
#define WW_PERSONALITY_ANIMATION_NONE 0
#define WW_PERSONALITY_ANIMATION_1 1
#define WW_PERSONALITY_ANIMATION_2 2
#define WW_PERSONALITY_ANIMATION_3 3
#define WW_PERSONALITY_ANIMATION_INVALID 255

typedef unsigned int WWBeaconDataType;
#define WW_BEACON_DATA_TYPE_COLOR 0
#define WW_BEACON_DATA_TYPE_USER 1
typedef NS_ENUM(unsigned int, WWComponentId) {
WW_COMMAND_POWER = 1,
WW_COMMAND_EYE_RING = 100,
WW_COMMAND_LIGHT_RGB_EYE = 101,
WW_COMMAND_LIGHT_RGB_LEFT_EAR = 102,
WW_COMMAND_LIGHT_RGB_RIGHT_EAR = 103,
WW_COMMAND_LIGHT_RGB_CHEST = 104,
WW_COMMAND_LIGHT_MONO_TAIL = 105,
WW_COMMAND_LIGHT_MONO_BUTTON_MAIN = 106,
WW_COMMAND_HEAD_POSITION_TILT = 202,
WW_COMMAND_HEAD_POSITION_PAN = 203,
WW_COMMAND_BODY_LINEAR_ANGULAR = 204,
WW_COMMAND_BODY_POSE = 205,
WW_COMMAND_MOTOR_HEAD_BANG = 210,
WW_COMMAND_BODY_WHEELS = 211,
WW_COMMAND_BODY_COAST = 212,
WW_COMMAND_SPEAKER = 300,
WW_COMMAND_ON_ROBOT_ANIM = 301,
WW_COMMAND_LAUNCHER_FLING = 400,
WW_COMMAND_LAUNCHER_RELOAD = 401,
WW_SENSOR_BUTTON_MAIN = 1000,
WW_SENSOR_BUTTON_1 = 1001,
WW_SENSOR_BUTTON_2 = 1002,
WW_SENSOR_BUTTON_3 = 1003,
WW_SENSOR_HEAD_POSITION_PAN = 2000,
WW_SENSOR_HEAD_POSITION_TILT = 2001,
WW_SENSOR_BODY_POSE = 2002,
WW_SENSOR_ACCELEROMETER = 2003,
WW_SENSOR_GYROSCOPE = 2004,
WW_SENSOR_DISTANCE_FRONT_LEFT_FACING = 3000,
WW_SENSOR_DISTANCE_FRONT_RIGHT_FACING = 3001,
WW_SENSOR_DISTANCE_BACK = 3002,
WW_SENSOR_ENCODER_LEFT_WHEEL = 3003,
WW_SENSOR_ENCODER_RIGHT_WHEEL = 3004,
WW_SENSOR_MICROPHONE = 3005,
};

typedef NS_ENUM(NSInteger, WWRobotType) {
WW_ROBOT_UNKNOWN = 1000,
WW_ROBOT_DASH = 1001,
WW_ROBOT_DOT = 1002,
};

typedef NS_ENUM(NSUInteger, WWPersonalityColorIndex) {
WW_PERSONALITY_COLOR_NONE = 0, // aka white
WW_PERSONALITY_COLOR_YELLOW = 1, // do not renumber these!
WW_PERSONALITY_COLOR_GREEN = 2,
WW_PERSONALITY_COLOR_ORANGE = 3,
WW_PERSONALITY_COLOR_BLUE = 4,
WW_PERSONALITY_COLOR_RED = 5,
WW_PERSONALITY_COLOR_PURPLE = 6,
WW_PERSONALITY_COLOR_INVALID = 255
};

typedef NS_ENUM(NSUInteger, WWRobotColorIndex) {
WW_ROBOT_COLOR_WHITE = WW_PERSONALITY_COLOR_NONE,
WW_ROBOT_COLOR_YELLOW = WW_PERSONALITY_COLOR_YELLOW,
WW_ROBOT_COLOR_GREEN = WW_PERSONALITY_COLOR_GREEN,
WW_ROBOT_COLOR_ORANGE = WW_PERSONALITY_COLOR_ORANGE,
WW_ROBOT_COLOR_BLUE = WW_PERSONALITY_COLOR_BLUE,
WW_ROBOT_COLOR_RED = WW_PERSONALITY_COLOR_RED,
WW_ROBOT_COLOR_PURPLE = WW_PERSONALITY_COLOR_PURPLE,
WW_ROBOT_COLOR_BLUE2 = (WW_PERSONALITY_COLOR_PURPLE + 1),
WW_ROBOT_COLOR_OFF = (WW_PERSONALITY_COLOR_PURPLE + 2),
WW_ROBOT_COLOR_INVALID = WW_PERSONALITY_COLOR_INVALID
};

typedef NS_ENUM(NSUInteger, WWPersonalityAnimationIndex) {
WW_PERSONALITY_ANIMATION_NONE = 0,
WW_PERSONALITY_ANIMATION_1 = 1,
WW_PERSONALITY_ANIMATION_2 = 2,
WW_PERSONALITY_ANIMATION_3 = 3,
WW_PERSONALITY_ANIMATION_INVALID = 255,
};

typedef NS_ENUM(NSUInteger, WWBeaconDataType) {
WW_BEACON_DATA_TYPE_COLOR = 0,
WW_BEACON_DATA_TYPE_USER = 1
};

#define WW_BEACON_RECEIVER_LEFT (1 << 0)
#define WW_BEACON_RECEIVER_RIGHT (1 << 1)
Expand Down Expand Up @@ -157,26 +163,26 @@ typedef unsigned int WWBeaconDataType;
#define WW_COMMAND_VALUE_ORDER_INDEX __wwstr__"index"


typedef enum {
typedef NS_ENUM(NSUInteger, WWPoseMode) {
WW_POSE_MODE_GLOBAL = 0,
WW_POSE_MODE_RELATIVE_COMMAND,
WW_POSE_MODE_RELATIVE_MEASURED,
WW_POSE_MODE_SET_GLOBAL,
WW_POSE_MODE_SET_TEMP_GLOBAL,
WW_POSE_MODE_TEMP_GLOBAL
} WWPoseMode;
} ;

typedef enum {
typedef NS_ENUM(NSUInteger, WWPoseDirection) {
WW_POSE_DIRECTION_FORWARD = 0,
WW_POSE_DIRECTION_BACKWARD,
WW_POSE_DIRECTION_INFERRED,
} WWPoseDirection;
} ;

typedef enum {
typedef NS_ENUM(NSUInteger, WWPoseWrap) {
WW_POSE_WRAP_OFF = 0,
WW_POSE_WRAP_ON,
} WWPoseWrap;
} ;

#undef wwstr

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright (c) 2014 Wonder Workshop inc. (https://www.makewonder.com/) All rights reserved.
//

#import <Foundation/Foundation.h>

// common
#import <WWRobotAPI/WWConstants.h>
#import <WWRobotAPI/WWContentDefinitions.h>
Expand Down
Loading