<builder autoBuildTarget="all" buildPath="${workspace_loc:/gear-racing-controller}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.227410736" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
- <tool command="i586-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.1679874459" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+ <tool command="arm-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.1679874459" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
<tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1354257060" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
<option id="sbi.gnu.cpp.compiler.option.912899474" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
- <listOptionValue builtIn="false" value="wearable-4.0-emulator.core_llvm40.i386"/>
+ <listOptionValue builtIn="false" value="wearable-4.0-device.core_llvm40.armel"/>
</option>
<listOptionValue builtIn="false" value=" -fPIE"/>
<listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+
+ <listOptionValue builtIn="false" value="-mthumb"/>
</option>
<option id="sbi.gnu.c.compiler.option.1123455384" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
- <listOptionValue builtIn="false" value="wearable-4.0-emulator.core_llvm40.i386"/>
+ <listOptionValue builtIn="false" value="wearable-4.0-device.core_llvm40.armel"/>
</option>
<listOptionValue builtIn="false" value=" -fPIE"/>
<listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+
+ <listOptionValue builtIn="false" value="-mthumb"/>
</option>
void controller_racing_destroy(void);
void controller_racing_back(void);
void controller_racing_next();
+void controller_racing_set_stop(bool stop);
#endif /* CONTROLLER_CONTROLLER_RACING_H_ */
void model_car_connection_send_direction(float direction);
void model_car_connection_send_throttle(float throttle);
void model_car_connection_ready_to_drive(bool is_ready);
-
+void model_car_connection_set_stop(bool stop);
#endif /* MODEL_MODEL_CAR_CONNECTION_H_ */
s_info.base_controller.view_update_cb(&s_info.controller_data);
}
+void controller_racing_set_stop(bool stop)
+{
+ model_car_connection_set_stop(stop);
+}
+
void controller_racing_init(t_view_update_cb view_update_cb)
{
s_info.base_controller.view_update_cb = view_update_cb;
void controller_reset_destroy(void)
{
model_cloud_connection_unsubscirbe_event();
+ model_car_connection_unsubscirbe_event();
model_car_connection_end_connection();
- model_car_connection_unsubscirbe_event();
}
static void _connected_cb(s_model_cloud_connection_cb_data *model_data)
#include "model/model_car_connection.h"
#include "log.h"
-#define BASE_VALUE 100
+#define BASE_VALUE 1000
#define HELLO_TIMER_WAIT 3.0
typedef enum _e_message_type {
float direction;
float throttle;
+ bool stop;
+
+ Ecore_Timer *send_timer;
} s_model_car_connection;
s_model_car_connection s_info = { 0, };
GError *error = NULL;
static s_message message = { 0, };
- _D("Send CMD[%d], Servo[%d], Speed[%d]", message.cmd, message.servo, message.speed);
-
message.cmd = command;
message.servo = servo;
message.speed = speed;
message.seq_num++;
message.time = time(NULL);
+ _D("Send CMD[%d], Servo[%d], Speed[%d]", message.cmd, message.servo, message.speed);
+
ASSERT(!s_info.socket, "Socket not created");
ASSERT(!s_info.car_address, "Destination not set");
return renew;
}
+static Eina_Bool _send_timer_cb(void *data)
+{
+ if (s_info.stop) {
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ _D("DATA: %f %f", s_info.direction, s_info.throttle);
+ _send_data(MESSAGE_DRIVE, s_info.direction * -BASE_VALUE, s_info.throttle * 4095);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
void model_car_connection_init(void)
{
// s_info.controller_update_cb(&model_data);
+ s_info.send_timer = ecore_timer_add(1.0 / 60.0, _send_timer_cb, NULL);
+
if (error) {
g_error_free(error);
}
if (error) {
g_error_free(error);
}
+
+ ecore_timer_del(s_info.send_timer);
}
void model_car_connection_send_direction(float direction)
{
- if (!s_info.ready_to_drive) {
+ if (!s_info.ready_to_drive || s_info.stop) {
return;
}
s_info.direction = direction;
- _send_data(MESSAGE_DRIVE, s_info.direction * -BASE_VALUE, s_info.throttle * -BASE_VALUE);
+// _send_data(MESSAGE_DRIVE, s_info.direction * -BASE_VALUE, s_info.throttle * -BASE_VALUE);
}
void model_car_connection_send_throttle(float throttle)
{
- if (!s_info.ready_to_drive) {
+ if (!s_info.ready_to_drive || s_info.stop) {
return;
}
s_info.throttle = throttle;
- _send_data(MESSAGE_DRIVE, s_info.direction * -BASE_VALUE, s_info.throttle * -BASE_VALUE);
+// _send_data(MESSAGE_DRIVE, s_info.direction * -BASE_VALUE, s_info.throttle * -BASE_VALUE);
+}
+
+void model_car_connection_set_stop(bool stop)
+{
+ s_info.stop = stop;
+
+ if (stop) {
+ _send_data(MESSAGE_DRIVE, 0, 0);
+ }
}
#include "log.h"
-#define THROTTLE_STEP 0.01
+#define THROTTLE_STEP 0.03
typedef struct _s_model_hw {
t_model_hw_update_cb hw_update_cb;
{
evas_object_hide(s_info.velocity);
evas_object_hide(s_info.direction);
+
+ controller_racing_set_stop(true);
}
void _stop_longpress_completed(void *data, Evas_Object *obj, const char *emission, const char *source)
}
s_info.stop_longpress = false;
+
+ controller_racing_set_stop(false);
ASSERT_FUNCTION_END;
}
elm_layout_signal_callback_add(s_info.view_base.view, "stop_pressed", "", _stop_longpress_completed, NULL);
elm_layout_signal_callback_add(s_info.view_base.view, "stop_released", "", _stop_logpress_up, NULL);
+
+ controller_racing_set_stop(false);
}
static void _show_cb(void)