addPassageMode static method

void addPassageMode(
  1. TTPassageModeType type,
  2. List<int>? weekly,
  3. List<int>? monthly,
  4. int startTime,
  5. int endTime,
  6. String lockData,
  7. TTSuccessCallback callback,
  8. TTFailedCallback failedCallback,
)

Config the lock passage mode. If config succeed,the lock will always be unlocked

type weekly Any number 1-7, 1 means Monday,2 means Tuesday ,...,7 means Sunday, such as 1,3,6,7. If type == TTPassageModeTypeMonthly, the weekly should be set null monthly Any number from 1 to 31, such as @@1,@13,@26,@31. If type == TTPassageModeTypeWeekly, the monthly should be set null startTime The time when it becomes valid (minutes from 0 clock) endTime The time when it is expired (minutes from 0 clock) lockData The lock data string used to operate lock

Implementation

static void addPassageMode(
      TTPassageModeType type,
      List<int>? weekly,
      List<int>? monthly,
      int startTime,
      int endTime,
      String lockData,
      TTSuccessCallback callback,
      TTFailedCallback failedCallback) {
    Map map = Map();
    map[TTResponse.passageModeType] = type.index;
    map[TTResponse.startDate] = startTime;
    map[TTResponse.endDate] = endTime;
    map[TTResponse.lockData] = lockData;
    if (type == TTPassageModeType.weekly) {
      map[TTResponse.weekly] = weekly;
    } else {
      map[TTResponse.monthly] = monthly;
    }
    invoke(COMMAND_ADD_PASSAGE_MODE, map, callback, fail: failedCallback);
  }