return ERRCODE_SUCC;
}
+static uint32_t enabledrag(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+ UNUSED(strCommonCmd);
+ uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+ uint32_t argc = 0;
+ uint8_t send_data[8] = {0};
+
+
+ int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+ if (ret != CUSTOM_UTILS_SUCCESS) {
+ wstp_print("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n");
+ return ERRCODE_FAIL;
+ }
+
+ if (argc != 2) {
+ wstp_print("CUSTOM_UTILSTEST enabledrag ATCMD Set Parameter Failed argc %d\r\n",argc);
+ return ERRCODE_FAIL;
+ }
+ uint8_t direction = atol((char*)argv[0]);
+ uint8_t enable = atol((char*)argv[1]);
+
+ enable_drag(direction,enable);
+ uint8_t limit=get_drag_limit(direction);
+ wstp_print("%s %s , current limit %d\r\n",enable==1?"enable":"disable",direction==0?"x":"y",limit);
+
+ return ERRCODE_SUCC;
+}
+
+
+static uint32_t setdraglimit(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+ UNUSED(strCommonCmd);
+ uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+ uint32_t argc = 0;
+ uint8_t send_data[8] = {0};
+
+
+ int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+ if (ret != CUSTOM_UTILS_SUCCESS) {
+ wstp_print("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n");
+ return ERRCODE_FAIL;
+ }
+
+ if (argc != 2) {
+ wstp_print("CUSTOM_UTILSTEST enabledrag ATCMD Set Parameter Failed argc %d\r\n",argc);
+ return ERRCODE_FAIL;
+ }
+ uint8_t direction = atol((char*)argv[0]);
+ uint8_t value = atol((char*)argv[1]);
+
+ set_drag_limit(direction,value);
+ uint8_t limit=get_drag_limit(direction);
+ wstp_print("set drag %s limit %d (current limit %d) \r\n",direction==0?"x":"y",value,limit);
+
+ return ERRCODE_SUCC;
+}
static uint32_t leantest(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
{
{ (char *)"AT^SETVOLUME", custom_volume_test, (char *)" " },
{ (char *)"AT^CYWEESAVEKEY", custom_cywee_save_mac_key, (char *)" " },
{ (char *)"AT^RESFILECHECK", custom_resfiles_checksum, (char *)" " },
- { (char *)"AT^LEANTEST", leantest, (char *)" " },
+ { (char *)"AT^LEANTEST", leantest, (char *)" " },
+ { (char *)"AT^ENABLEDRAG", enabledrag, (char *)" " },
+ { (char *)"AT^SETDRAGLIMIT", setdraglimit, (char *)" " },
};
touchableView_ = nullptr;
}
+extern "C" {
+
+static uint16_t DRAG_LIMIT_X = INDEV_DRAG_LIMIT;
+static uint16_t DRAG_LIMIT_Y = INDEV_DRAG_LIMIT;
+/**
+ * param direction 0 = X , 1 = Y
+*/
+void enable_drag(uint8_t direction, uint8_t enable)
+{
+ if (enable == 0 ) //disable drag
+ {
+ if (direction == 0) //X
+ {
+ DRAG_LIMIT_X = 0xFFFF;
+ }else{ //Y
+ DRAG_LIMIT_Y= 0xFFFF;
+ }
+ }else{ //enable drag
+ if (direction == 0) //X
+ {
+ DRAG_LIMIT_X = INDEV_DRAG_LIMIT;
+ }else{ //Y
+ DRAG_LIMIT_Y= INDEV_DRAG_LIMIT;
+ }
+ }
+
+}
+
+void set_drag_limit(uint8_t direction, uint16_t limit)
+{
+
+ if (direction == 0) //X
+ {
+ DRAG_LIMIT_X = limit;
+ }else{ //Y
+ DRAG_LIMIT_Y= limit;
+ }
+}
+
+uint16_t get_drag_limit(uint8_t direction)
+{
+ if (direction == 0)
+ {
+ return DRAG_LIMIT_X;
+ }else{
+ return DRAG_LIMIT_Y;
+ }
+}
+
+}
void PointerInputDevice::DispatchDragStartEvent()
{
if (draggableView_ == nullptr) {
dragLen_.x += dragStep_.x;
dragLen_.y += dragStep_.y;
if (!isDragging_) {
- if ((MATH_ABS(dragLen_.x) >= INDEV_DRAG_LIMIT) || (MATH_ABS(dragLen_.y) >= INDEV_DRAG_LIMIT)) {
+ if ((MATH_ABS(dragLen_.x) >= DRAG_LIMIT_X) || (MATH_ABS(dragLen_.y) >= DRAG_LIMIT_Y)) {
+
+ printf("=====PointerInputDevice::DispatchDragStartEvent absx(%d) limitx(%d) absy(%d) limity(%d) \r\n",
+ MATH_ABS(dragLen_.x),DRAG_LIMIT_X,
+ MATH_ABS(dragLen_.y),DRAG_LIMIT_Y);
+
if ((touchableView_ != nullptr) && !cancelSent_) {
DispatchCancelEvent();
}