<commit_before>package io.particle.mesh.setup

import androidx.annotation.WorkerThread
import io.particle.android.sdk.cloud.ParticleCloud
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType
import io.particle.mesh.setup.flow.Gen3ConnectivityType


@WorkerThread
fun BarcodeData.toDeviceType(cloud: ParticleCloud): ParticleDeviceType {
    return this.serialNumber.toDeviceType(cloud)
}


@WorkerThread
fun BarcodeData.toConnectivityType(cloud: ParticleCloud): Gen3ConnectivityType {
    return this.serialNumber.toDeviceType(cloud).toConnectivityType()
}


fun ParticleDeviceType.toConnectivityType(): Gen3ConnectivityType {
    return when (this) {
        ParticleDeviceType.ARGON,
        ParticleDeviceType.A_SOM -> Gen3ConnectivityType.WIFI
        ParticleDeviceType.BORON,
        ParticleDeviceType.B_SOM -> Gen3ConnectivityType.CELLULAR
        ParticleDeviceType.XENON,
        ParticleDeviceType.X_SOM -> Gen3ConnectivityType.MESH_ONLY
        else -> throw IllegalArgumentException("Not a mesh device: $this")<commit_msg>This gets used outside of just mesh devices now; handle all device types<commit_after>package io.particle.mesh.setup

import androidx.annotation.WorkerThread
import io.particle.android.sdk.cloud.ParticleCloud
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ARGON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.A_SOM
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.BLUZ
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.BORON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.B_SOM
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.CORE
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.DIGISTUMP_OAK
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ELECTRON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.OTHER
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.P1
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.PHOTON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.RASPBERRY_PI
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.RED_BEAR_DUO
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.XENON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.X_SOM
import io.particle.mesh.setup.flow.Gen3ConnectivityType
import io.particle.mesh.setup.flow.Gen3ConnectivityType.CELLULAR
import io.particle.mesh.setup.flow.Gen3ConnectivityType.MESH_ONLY
import io.particle.mesh.setup.flow.Gen3ConnectivityType.WIFI


@WorkerThread
fun BarcodeData.toDeviceType(cloud: ParticleCloud): ParticleDeviceType {
    return this.serialNumber.toDeviceType(cloud)
}


@WorkerThread
fun BarcodeData.toConnectivityType(cloud: ParticleCloud): Gen3ConnectivityType {
    return this.serialNumber.toDeviceType(cloud).toConnectivityType()
}


fun ParticleDeviceType.toConnectivityType(): Gen3ConnectivityType {
    return when (this) {
        OTHER,
        CORE,
        PHOTON,
        P1,
        RASPBERRY_PI,
        RED_BEAR_DUO,
        BLUZ,
        DIGISTUMP_OAK,
        ARGON,
        A_SOM -> WIFI

        ELECTRON,
        BORON,
        B_SOM -> CELLULAR

        XENON,
        X_SOM -> MESH_ONLY
{'fraction_non_alphanumeric': 0.08321210357870236, 'fraction_numerical': 0.004073319755600814, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, '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': '3746661', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1061, 'n_words': 141}