<commit_before>//
//  ReadCurrentPageNumberMessageBody.swift
//  RileyLink
//
//  Created by <NAME> on 2/17/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public class ReadCurrentPageNumberMessageBody : MessageBody {
    public static var length: Int = 64
    public let pageNum: Int

    let rxData: Data
    
    public var txData: Data {
        return rxData
    }
 
    // Partially implemented from https://github.com/bewest/decoding-carelink/blob/master/decocare/commands.py#L575
    public required init?(rxData: Data) {
        var page = 0
        
        //NOTE: Page Number  is likely 4 bytes little endian but anything longer that one byte is not implemented
        if rxData.count > 1 {
            page = Int(rxData[0])
        }
        
        if page < 0 || page > 36 {
            page = 36
        }
        
        pageNum = page
        self.rxData = rxData
    }
}
<commit_msg>Change super class to CarelinkLongMessageBody per Nate's comment<commit_after>//
//  ReadCurrentPageNumberMessageBody.swift
//  RileyLink
//
//  Created by <NAME> on 2/17/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public class ReadCurrentPageNumberMessageBody : CarelinkLongMessageBody {
    public let pageNum: Int
 
    // Partially implemented from https://github.com/bewest/decoding-carelink/blob/master/decocare/commands.py#L575
    public required init?(rxData: Data) {
        var page = 0
        
        //NOTE: Page Number  is likely 4 bytes little endian but anything longer that one byte is not implemented
        if rxData.count > 1 {
            page = Int(rxData[0])
        }
        
        if page < 0 || page > 36 {
            page = 36
        }
        
        pageNum = page
        super.init(rxData: rxData)
    }
}

{'fraction_non_alphanumeric': 0.0888030888030888, 'fraction_numerical': 0.024269167126309985, 'mean_word_length': 2.028380634390651, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737592', 'n_tokens_mistral': 566, 'n_tokens_neox': 522, 'n_words': 162}