You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ZXWifiParsedResult.m 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2012 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "ZXParsedResultType.h"
  17. #import "ZXWifiParsedResult.h"
  18. @implementation ZXWifiParsedResult
  19. - (id)initWithNetworkEncryption:(NSString *)networkEncryption ssid:(NSString *)ssid password:(NSString *)password {
  20. return [self initWithNetworkEncryption:networkEncryption ssid:ssid password:password];
  21. }
  22. - (id)initWithNetworkEncryption:(NSString *)networkEncryption ssid:(NSString *)ssid password:(NSString *)password hidden:(BOOL)hidden {
  23. if (self = [super initWithType:kParsedResultTypeWifi]) {
  24. _ssid = ssid;
  25. _networkEncryption = networkEncryption;
  26. _password = password;
  27. _hidden = hidden;
  28. }
  29. return self;
  30. }
  31. + (id)wifiParsedResultWithNetworkEncryption:(NSString *)networkEncryption ssid:(NSString *)ssid password:(NSString *)password {
  32. return [[self alloc] initWithNetworkEncryption:networkEncryption ssid:ssid password:password];
  33. }
  34. + (id)wifiParsedResultWithNetworkEncryption:(NSString *)networkEncryption ssid:(NSString *)ssid password:(NSString *)password hidden:(BOOL)hidden {
  35. return [[self alloc] initWithNetworkEncryption:networkEncryption ssid:ssid password:password hidden:hidden];
  36. }
  37. - (NSString *)displayResult {
  38. NSMutableString *result = [NSMutableString stringWithCapacity:80];
  39. [ZXParsedResult maybeAppend:self.ssid result:result];
  40. [ZXParsedResult maybeAppend:self.networkEncryption result:result];
  41. [ZXParsedResult maybeAppend:self.password result:result];
  42. [ZXParsedResult maybeAppend:[@(self.hidden) stringValue] result:result];
  43. return result;
  44. }
  45. @end